?
Solved

Cleanup MovieClips on Scene Change in ActionScript 2

Posted on 2010-11-21
5
Medium Priority
?
561 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
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.
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.
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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