Note that there are some explanatory texts on larger screens.

plurals
  1. POMovie Clips is working before it is added to DisplayList?
    text
    copied!<p>I have to add a list of objects into an Array so I can access them Later, but for some reason the object I have added plays before, I add them on to the display list. here is the code:</p> <p>the Frame Where the list is Added:</p> <pre><code>sunny.addEventListener(MouseEvent.CLICK, sunny_choice); function sunny_choice(E:MouseEvent) { var sunny_walkcycle: Sunny_Walkcycle = new Sunny_Walkcycle (); var sunny_busstop : Sunny_BusStop = new Sunny_BusStop (); var sunny_opening: Teacher_Opening_Sunny = new Teacher_Opening_Sunny (); clothingArray.push( sunny_walkcycle); clothingArray.push( sunny_busstop); clothingArray.push( sunny_opening); trace("Sunny"); cleaner(); //cleaner just removes the event listener and asks it to go to the next frame } </code></pre> <p>Th next Frame:</p> <pre><code>clothingArray [0].scaleX = -1; addChild (clothingArray [0]); clothingArray[0].x = 633; clothingArray[0].y = 174; clothingArray [0].stop (); clothingArray [0].addEventListener (MouseEvent.CLICK, transforming); function transforming (e:MouseEvent) { if (clothingArray [0].currentFrame == clothingArray [0].totalFrames) { clearall2 (); } else{ clothingArray [0].nextFrame(); moving_background.nextFrame (); } } function clearall2 () { clothingArray [0].removeEventListener (MouseEvent.CLICK, transforming); removeChild (clothingArray [0]); gotoAndStop (3); } </code></pre> <p>The problematic One:</p> <pre><code>addChild (clothingArray [1]); clothingArray[1].addEventListener (Event.ENTER_FRAME , busstop); trace ("The Current Frame is " + clothingArray [1].currentFrame); function busstop (d:Event) { if (clothingArray [1].currentFrame == clothingArray [1].totalFrames) { clearall3 (); } } function clearall3 () { removeChild (clothingArray [1]); clothingArray[1].removeEventListener (Event.ENTER_FRAME , busstop); } </code></pre> <p>So what Exactly it does is the movieclip in Frame 3 starts playing before it's even added to the Display list and i am not sure what is causing it...I cannot separately add the variable at this frame because there are other options in frame 1 that leads to me making an array.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload