A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: disappearing MC's on frame change

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    2

    disappearing MC's on frame change

    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.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    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.
    - The right of the People to create Flash movies shall not be infringed. -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center