• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 566
  • Last Modified:

Cleanup MovieClips on Scene Change in ActionScript 2

           for(i=0;i<itemLength;i++)
            {
                  duplicateMovieClip("tvmenuitem", "tvmenuitem"+i, i);
...

However when I change the scene using: gotoAndPlay('main',1);

The main scene is overlayed with all the MovieClips I had in the previous scene.

How can I automagically clean them up?
0
iSteven
Asked:
iSteven
1 Solution
 
blue-genieCommented:
can you upload your file so we can have a look?
0
 
CyanBlueCommented:
You might want to create a lable and use it rather than referencing it with the scene name...

For example, go to the frame 1 of the scene 'main', and put a frame lable called 'start' and use gotoAndPlay("start"); instead of gotoAndPlay('main',1);

CyanBlue
0
 
tomaugerdotcomCommented:
Make all the movie clips children of a "master" clip that only appears on Scene 1. When you switch to Scene 2, that "master" movie clip will no longer be there, so all its children (your duplicate movie clips) will also be gone.
0
 
iStevenAuthor Commented:
How do I make it appear only in scene 1? I'm not sure how to make them children.
0
 
tomaugerdotcomCommented:
Create a new, empty movieclip on your stage. Call it "containerMC". Put your first "tvmenuitem" movie clip inside containerMC (here I'm assuming that tvmenuitem is a movie clip that you created on stage). Now, when you call duplicateMovieClip, tvmenuitem+i will be also a child of containerMC....

In scene 2, just make sure containerMC is gone...

T
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now