flash gotoAndPlay(variable);
- Started
- Last post
- 10 Responses
- fixate
what's the syntax for passing a variable as part of the gotoAndPlay();
// for exmaple --->
nextSlide = "two";gotoAndPlay(nextSlide);
//this obvisouly doesn't work
thanks.
- autonoma0
What you entered implies that you have a frame labelled "two'.
- fixate0
yes
- fixate0
i'm just wanting to know if you can pass variables within gotoAndPlay();
- versa0
you'd have to use it in a function with the var contained in it as well
- fixate0
//so
function myGoTo () {
gotoAndPlay(variable);
}
- versa0
no sorry
gotoAndPlay does not pass vars...its argument is reserved for where you want the playhead to go
just put the goto command and a var assignment inside of a function, and declare your var with just the name, ie, foo = fooValue; so that the var is good for the life of the timeline and not just good for that function
- autonoma0
You cannot pass variables within the goToAndPlay. you have to do:
function myGoTo() {
myMovieClip.myVariable = "noodle";
myMovieClip.gotoAndPlay(2);
}
- fixate0
sorry everyone it worked.. but i swear it wasn't before.
You can pass vars to it.
here's an exmaple that worked.
//on the frame
nextSlide = "frame_name";//on the button
on (release) {
gotoAndPlay(nextSlide);
}//booyah
- autonoma0
I misunderstood what you meant by "passing a variable". I thought you meant actually changing the variable definition in a clip, not using a variable to reveal the frame label..
- versa0
thought you were trying to do something totally different the way you wrote the original posts
sorry...
glad you solved your own problem
though