all groups > flash actionscript > january 2007 >
You're in the

flash actionscript

group:

Button that goes back to last keyframe


Button that goes back to last keyframe Jon Mattarocchia
1/3/2007 10:25:03 PM
flash actionscript:
i created a flash animation like whats http://www.mlb.com "the headline news
section in the middle of the page" now my problem is getting my forward and
back buttons to work. how can i make it so when somone clicks on the forward
button it skips to the next frame if they dont want to wait for it to get there
by itself? http://www.gameflak.com/news.html now i tried doing on (release) {
gotoAndPlay ("frame number"); } now it goes to that frame but all the images
that fade in and out are not in sink anymore and it doesnt play it just stays
on that frame with the images fading in and out, out of sink. any help would be
great.
Thanks
-Jon
Re: Button that goes back to last keyframe dr.Evol
1/4/2007 12:42:24 AM
you have to somehow store the last visited keyframe and then reference this
variable when you move back to the last keyframe.

create a variable : var f:Number;

then on each keyframe put: f=this._currentframe;

on the first frame of your main timeline put the following code to controll
the buttons:

var ref=this;
btnFW.onPress=function() { //this one is for moving forward
ref.play();
}

btnRW.onPress=function() { // this one is for going back to the last keyframe
ref.gotoAndStop(ref.f); //or put gotoAndPlay if you want to play from this
frame on
}

Why your images are fading I haved no idea since you didnt provide any
detailed info about you app. Probabbly your images are separate animations and
therefore you'll need to controll them separately.

cheers


Re: Button that goes back to last keyframe Jon Mattarocchia
1/4/2007 12:59:22 AM
Re: Button that goes back to last keyframe Jon Mattarocchia
1/4/2007 1:16:16 AM
[q][i]Originally posted by: [b][b]dr.Evol[/b][/b][/i]
you have to somehow store the last visited keyframe and then reference this
variable when you move back to the last keyframe.

create a variable : var f:Number;

then on each keyframe put: f=this._currentframe;

on the first frame of your main timeline put the following code to controll
the buttons:

var ref=this;
btnFW.onPress=function() { //this one is for moving forward
ref.play();
}

btnRW.onPress=function() { // this one is for going back to the last keyframe
ref.gotoAndStop(ref.f); //or put gotoAndPlay if you want to play from this
frame on
}

Why your images are fading I haved no idea since you didnt provide any
detailed info about you app. Probabbly your images are separate animations and
therefore you'll need to controll them separately.

cheers

[/q]

i added var ref=this;
btnFW.onPress=function() { //this one is for moving forward
ref.play();
}
to the first frame of the button timeline on the button and i got this error.

**Error**Scene=Scene1, Layer=Layer1, frame=Frame1: statement must apear within
on handler
var ref=this;


**Error**Scene=Scene1, Layer=Layer1, frame=Frame1: statement must apear within
on handler
btnFW.onPress=function()
AddThis Social Bookmark Button