Groups | Blog | Home
all groups > flash (macromedia) > june 2004 >

flash (macromedia) : Callback problem with simple menu


Nathan Olson
6/26/2004 9:53:22 PM
I'm trying to set up a menu in Flash MX using callback functions with the
script at Frame 1. The script:

button1.onRollOver = function() {this._alpha = 50;}
button1.onRollOut = function() {this._alpha = 0;}
button1.onRelease = function() {gotoAndStop("menu1");}

button2.onRollOver = function() {this._alpha = 50;}
button2.onRollOut = function() {this._alpha = 0;}
button2.onRelease = function() {gotoAndStop("menu2");}

button3.onRollOver = function() {this._alpha = 50;}
button3.onRollOut = function() {this._alpha = 0;}
button3.onRelease = function() {gotoAndStop("menu3");}

button4.onRollOver = function() {this._alpha = 50;}
button4.onRollOut = function() {this._alpha = 0;}
button4.onRelease = function() {gotoAndStop("menu4");}

stop();


This assumes, of course, button1 through button4 exist and the frame labels
are established and a "stop" command is placed at each label.

For reasons I don¹t understand (still a beginner in ActionSccript), the
above doesn't work the way I want it to. I want to be able to choose any
button and jump to its label. As is, if I choose "menu4", afterwards only
"menu1" is available to me.

Anybody know what I'm doing wrong?


Thanks in advance,
Nate Olson
tralfaz
6/26/2004 11:19:10 PM

[quoted text, click to view]

No, that is not correct. Only Flash 5 and earlier can't have instance
names on buttons.
tralfaz

seb
6/27/2004 1:22:47 AM
What is supposed to go to and stop at the frame labels?
You don't say it in your code.
try:
_root.gotoAndStop("menu1");

Then, you gave instance names to your buttons, which is not supported by
any flash player prior version 7.
For support with player 5 up to 7, I suggest you move your code from the
main timeline to your actual buttons, i.e. select button1, get rid of
its instance name, and with the button selected, write in AS panel:

on (rollOver) {
this._alpha = 50;
}
on (rollOut) {
this._alpha = 0;
}
on (release) {
_root.gotoAndStop("menu1");
}

Hope this helps.

[quoted text, click to view]
seb
6/27/2004 2:28:53 AM
sorry, my bad.

[quoted text, click to view]
AddThis Social Bookmark Button