-
1. Re: Problem removing Objects from the stage in Flash CS4 (AS3.0)
Rob Dillon Oct 16, 2009 5:21 AM (in response to Me2LoveIt2)If you want to remove an object from the stage as soon as the movie begins why have it there in the first place? In any case, using:
removeChild(vanish_mc);
will execute more quickly and doesn't involve a hitTestObject() function.
-
2. Re: Problem removing Objects from the stage in Flash CS4 (AS3.0)
Me2LoveIt2 Oct 16, 2009 11:05 AM (in response to Rob Dillon)Thank you for the reply.
This example is just a simple version of my problem to keep it simple and easy to understand.
I tried the code you gave me, but it still seems to see "something" and with something i mean i don't know what.
once the object vanished i keep getting this argument:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
Do you know what the problem might be?
~Thank you for your help!
-
3. Re: Problem removing Objects from the stage in Flash CS4 (AS3.0)
Rob Dillon Oct 16, 2009 1:46 PM (in response to Me2LoveIt2)That error means that there is a disagreement between the path to vanish_mc and the location of the actionscript. Use the target tool in the actions window to give you the path to vanish_mc and then use that. You will probably want to remove the "this." that starts the path.
-
4. Re: Problem removing Objects from the stage in Flash CS4 (AS3.0)
Vikas_Sharma Oct 16, 2009 1:57 PM (in response to Rob Dillon)Does removing the listener along with the vanish_mc object make any difference?
-
5. Re: Problem removing Objects from the stage in Flash CS4 (AS3.0)
Me2LoveIt2 Oct 16, 2009 2:43 PM (in response to Rob Dillon)Ah I think the problem is what my problem not which I proposed, my bad I was trying to keep it simple.
the remove code in my problem actually looks like this:
..... if(character_mc.hitTestObject(this["dollar_mc_"+String(i)])){ removeChild(this["dollar_mc_"+String(i)]); .....I wanted it to be that way so I could add infinite "dollar_mc_" ' s without writing myself to death with code and or getting confused.
Imagine it like a game where a character it picking up dollars, which would disappear once they intersect.
And that exactly is what gives me that argument.
Do you know a way i could write this code, or do you suggest to leave it that way...because it does run and work im just getting this argument while debugging.
Thank you for all the help~
-
6. Re: Problem removing Objects from the stage in Flash CS4 (AS3.0)
Vikas_Sharma Oct 16, 2009 3:00 PM (in response to Me2LoveIt2)Have you traced what --
this["dollor_mc_" + String(i)]
-- actually returns...?
-
7. Re: Problem removing Objects from the stage in Flash CS4 (AS3.0)
Rob Dillon Oct 18, 2009 8:17 AM (in response to Vikas_Sharma)I'm having more than a little difficulty visuallizing what you are attempting, but here are some thoughts that might help. You should be attaching the event listener to the character_mc. Then you are testing it against any number of dollar_mc clips. I don't know how you are adding the dollar_mc clips to the display object, but if you put a reference to each one in an array, you can then run through the array to do the hitTestObject. When a hit occurs, you can then remove that instance of dollar_mc from the display list.



