views:

22

answers:

2

I have a movie clip loaded on the stage.

The stage loops through a few clips so this one gets removed and added to the stage again and again by itself. How can I modify the contents of it on each loop iteration?

Can I add some event listener to it (or it's parent, which is...? stage?)

I already tried something like:

stage.addEventListener(Event.ADDED, Staged);

and the Staged function:

private function Staged (e:event):void
{
    trace(e.prototype);
}

and the Staged() function gets fired a whole lot, but from it's parameter (the event passed) I can't find out which object it is or anything...

+1  A: 

if we are talking about flash IDE you should use stop(), gotoAndPlay(number) and gotoAndStop(number) to navigate btw stages, but if you want to add handler and catch each event of object adding, you should apply addEventListener function to each such object you want to handle.

fyi

Eugene
A: 

You should apply the ADDED event listener to the MovieClip you want to monitor , not the stage. This way, in the Staged() function , you will be able to reference that specific MovieClip by using the event.target property.

Edit:

Then you should try Eugene's solution. Use gotoAndStop() to move from frame to frame and on the frame have a function that loads your MovieClip with new content.

changeMovieClipContent();

function changeMovieClipContent()
{
  //your code here

  //when the new content has been added
  gotoAndStop('nextFrame');
}
PatrickS
I tried that (adding an event listener to the containing movie clip) but it doesn't get fired. public function myFlashProject() { containingMovieClip.addEventListener(Event.ADDED, theEventHandler);
arnorhs