Solved

Cleanup MovieClips on Scene Change in ActionScript 2

Posted on 2010-11-21
5
555 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
ID: 34184126
can you upload your file so we can have a look?
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 34184407
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
ID: 34199684
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
ID: 34203099
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
ID: 34213019
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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 how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

867 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

17 Experts available now in Live!

Get 1:1 Help Now