I am trying to create a simple gallery. I have created a gallery movieclip that contains 4 frames with pictures. The above code works fine for one trigger. The gallery mc moves to frame 2 and the second image is shown. The next trigger though (after 2 more seconds) doesn't work properly. It gets stuck (eg other buttons of the stage aren't clickable any more). If I trace the NextPhoto function, it outputs two times and nothing more. What am I missing and the second trigger is not working?
import flash.utils.Timer;
stop();
gallery1.stop();
var myTimer:Timer = new Timer(2000);
myTimer.addEventListener(TimerEvent.TIMER, NextPhoto);
myTimer.start();
function NextPhoto(TimerEvent):void
{
if (gallery1.currentFrame < gallery1.totalFrames){
gallery1.gotoAndStop(gallery1.currentFrame+1);
}
else if (gallery1.currentFrame == gallery1.totalFrames){
gallery1.gotoAndStop(1);
}
}
function nextPhoto(e:TimerEvent):void. You added the datatype as the argument. - Josh