Solved

Cleanup MovieClips on Scene Change in ActionScript 2

Posted on 2010-11-21
5
557 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

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…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

770 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