Also, lauri wrote some code for me, including a removeObject function, which you can see here:
function removeObject(obj:MovieClip, objectArray:Array):void
// Remove listener.
obj.removeEventListener(Event.ENTER_FRAME, enterFrameHandler, false);
// get array index
var i:int = objectArray.indexOf(obj);
// remove emement from array with index number
// remove object from stage
Is this something I could use to remove all children from the bear array (ba)? I tried to use the function, but I couldn't figure out how to write it.
I think I've thought of a way to remove all the bear children without placing them in a container... however it still isn't working... tell me what you think of this method:
I created a variable called "bearsOnStage" which keeps track of how many bear children are on the stage at any given time (I traced the value, and it works great).
Then I wrote this loop, which uses the removeObject function:
for(var i:uint = 0; i < bearsOnStage; i++)
I don't get any error messages when I run the swf, however, no bears are removed either.
What am I missing? it's the same line of code I use for when the bears get shot:
It works great when the bears are shot, but it's not doing anything in the loop...
Sorry if i'm missing something really dumb
I just realized that "bear" doesn't refer to the movieclip unless it's inside a function that's receiving a movie clip. Example:
The variable I created for a new bear movieclip child is "nb", but I can't figure out how to reference the child display object inside of a new function...