;

PDA

Click to See Complete Forum and Search --> : disappearing MC's on frame change


jdav800
05-20-2008, 01:14 AM
I have several mc's called ships_mc randomly added to the stage via addChild from the library at single frame 1 of scene "Harbor" showing a harbor. All is good.

Heres the problem:
Clicking a button on the stage takes you to scene2 where another button brings you back to the harbor but the ships_mc's disappear. What's worse is that their mouseEvents are still working 'cause when I click where they should be, the EventListeners still do their thing. It's like their visibility is set to false.

I thought only removeChild did this because at scene2 I couldn't stop dynamic mc's there from still being displayed when returning to the harbor scene WITHOUT removeChild and setting the mc's to null.

The logic in addChild of AS3 just sucks and there are lot's of posts here with hair pulling from frustrated people about addChild.
I appreciate any help or points in the rightdirection
Thanks in advance.

cancerinform
05-20-2008, 08:19 PM
I recommend you to place the ships within a hardcopy empty Sprite (mc) in that particular frame. Then add the following script.

if (mc.numChildren > 0)
{
do this
}
else
{
mc.addChild(ships);
}

I guess you know what is meant. AS3 is best to work with a single frame. Instead of using a second scene, which is not good practice, it is better to either create another Sprite or MovieClip or load another movie.