Can anyone please tell me how to write the code for making a timer to start when a movie clip enters the stage and the timer to stop when the movie clip moves out of the stage.
I have placed certain movie clips outside the stage and have made them move from right to left across the stage (of course, on an x axis, 3 pixels at a time). As each movie clip enters the stage, a related timer should be triggered. When the timer is triggered, it will start playing a specific audio clip on every two second interval. And when the movie clip moves out of the stage, the timer should stop, so that the mp3 audio will also be stopped. KINDLY SUGGEST SOME NON-OOP WAYS OF DOING IT. Its just the "triggering" and "stopping" part that i need.
stage.addEventListener(Event.ENTER_FRAME, loop)
function loop(e:Event){
if(e1.x <= -250){e1.x = 1250;}
if(e2.x <= -350){e2.x = 1325;}
if(e3.x <= -450){e3.x = 1400;}
if(e4.x <= -550){e4.x = 1475;}
if(e5.x <= -650){e5.x = 1550;}
if(e6.x <= -750){e6.x = 1625;}
e1.x -= 3;
e2.x -= 3;
e3.x -= 3;
e4.x -= 3;
e5.x -= 3;
e6.x -= 3;
}