Solved

Cleanup MovieClips on Scene Change in ActionScript 2

Posted on 2010-11-21
5
554 Views
Last Modified: 2013-11-11
           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
Comment
Question by:iSteven
5 Comments
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
can you upload your file so we can have a look?
0
 
LVL 37

Expert Comment

by:CyanBlue
Comment Utility
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
 
LVL 14

Expert Comment

by:tomaugerdotcom
Comment Utility
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
 

Author Comment

by:iSteven
Comment Utility
How do I make it appear only in scene 1? I'm not sure how to make them children.
0
 
LVL 14

Accepted Solution

by:
tomaugerdotcom earned 500 total points
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now