Reputation: 1461
I wrote an action script code for two frames,lets say frame 1 and frame 10. Now onClick() event on frame 1, i wrote like this.
on(release){
gotoAndStop(10);
}
Now from frame 1 to frame 10 i want to send some data like a boolean variable. So that i can execute appropriate action in frame 10.
Please let me know the possibilities of passing data between frames.
Upvotes: 1
Views: 1382
Reputation: 12431
The timeline in Flash is really the top-level MovieClip
and therefore any properties you set on it are accessible from any frame at that level. I would declare the variable in the first frame on your actions layer (before the stop()
action I assume you must have) like so:
var myBoolean = false; // set default
In the action for your button you can set the value of your boolean
:
on(release){
myBoolean = true; // myBoolean should be in scope from here, if not you could use _root.myBoolean
gotoAndStop(10);
}
And in frame 10 you can create a new frame on your actions layer and write the appropriate logic according to the value of the boolean
:
if (myBoolean) {
// ...
} else {
// ...
}
Upvotes: 1