Copy link to clipboard
Copied
Hey, I just started using AS for the first time and I have a small flash that I'm working on and everything has been going good. But I'm having a problem with a button.
I have imported two image strips, 100 frames each, and as soon the flash loads, it plays the first strip in a loop until I press the button to move to the next strip. However, here is the issue, while it indeed goes to the next strip, it doesn't wait for the other to finish. How can I make it wait for the previous strip to finish before moving on to the next one when the button is pressed?
yourbutton.addEventListener(MouseEvent.CLICK,f);
function f(e:MouseEvent):void{
this.addEventListener(Event.ENTER_FRAME,ff);
yourbutton.removeEventListener(MouseEvent.CLICK,f);
removeChild(yourbutton);
}
function ff(e:Event):void{
if(firststrip.currentFrame==firststrip.totalFrames){
this.removeEventListener(Event.ENTER_FRAME,ff);
// go to nextstrip
}
}
Copy link to clipboard
Copied
yourbutton.addEventListener(MouseEvent.CLICK,f);
function f(e:MouseEvent):void{
this.addEventListener(Event.ENTER_FRAME,ff);
yourbutton.removeEventListener(MouseEvent.CLICK,f);
removeChild(yourbutton);
}
function ff(e:Event):void{
if(firststrip.currentFrame==firststrip.totalFrames){
this.removeEventListener(Event.ENTER_FRAME,ff);
// go to nextstrip
}
}
Copy link to clipboard
Copied
Am I suppose to replace the firststrip part in this line: if(firststrip.currentFrame==firststrip.totalFrames){ with something?
Copy link to clipboard
Copied
you need to replace all the instance names with the ones you used and you need to replace "// go to nextstrip"
Copy link to clipboard
Copied
Oh right, ofcourse! Thank you for the help, it worked!
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now