function moveBall(evt:Event):void {
if (ball_mc.x < 500) {
tball_mc.x += 1;
} else {
stage.removeEventListener(Event.ENTER_FRAME, moveBall);
noticeMe();
}
}
function noticeMe():void{
trace(“The ball is stop”);
}
That should work.
If you want to dosomething when the playhead has reached the last frame you can simply trigger an event or a function by writing some code on that last frame of that movieclip or swf.
your code seams fine regarding what you need, you increment a value to the x position of a movieclip, and then you you reach a certain point it will stop increment and call a function. Really can’t figure out what do you need after all…
by the way I guess you typed something wrong there:
if (ball_mc.x < 500) {
tball_mc.x += 1;
(ball_mc / tball_mc)
although you could use tween animations so it would set an event for the animation, this way you could listen to a “complete”, that would go something like this:
sorry pier, haven’t see you answer. I tested the code and all seamed ok, just changed the name of tball_mc to ball_mc. When it ends the animation it calls the function… maybe i’m missing the point here…
Sorry, I made a typing mistake (tball_mc should be ball_mc).
Actually my movie has only one frame that use to write all the ActionScript. I am afraid that it cannot trigger an event or a function by writing some code on that last frame.
Yes, tween animations with listen to a “complete” should be what I need. Thanks for your code sample.