Groups | Blog | Home
all groups > flash actionscript > january 2006 >

flash actionscript : actionscript 101


Motion Maker
1/23/2006 4:09:18 PM
I am not clear but it appears you have a Button symbol and the gotoAndPlays
are trying reference it. A Button symbol shows its frames automatically and
you cannot address the frames with AS such as gotoAndPlay.

You can however change the instance behavior of a Button to a MovieClip or
you could change the library behavior to a MovieClip. Once a MovieClip you
could do the following assuming buttonover is the instance name of the
MovieClip object.

buttonover.onRollOver = function()
{
this.gotoAndPlay(2);
}

buttonover.onRelease = buttonover.onRollOut = function ()
{
this.gotoAndPlay(3);
}




--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
Hello,
I am trying to figure out how to keep the release state of a button the
same
after being clicked on so far i have created a(n) Up, Over and Down state
plus
entered a script that would allow text to be displayed as the pointer is
passed
over the button as follows: on(rollOver){
tellTarget("buttonover"){
gotoAndPlay(2);
}
}
on(release, rollOut){
tellTarget("buttonover"){
gotoAndPlay(3);
}
}
If there is anyone who can assist me in finding a solution for what seems
to
be a simple case please assist.

Thank you!

pantherdev
1/23/2006 7:32:18 PM
Hello,
I am trying to figure out how to keep the release state of a button the same
after being clicked on so far i have created a(n) Up, Over and Down state plus
entered a script that would allow text to be displayed as the pointer is passed
over the button as follows: on(rollOver){
tellTarget("buttonover"){
gotoAndPlay(2);
}
}
on(release, rollOut){
tellTarget("buttonover"){
gotoAndPlay(3);
}
}
If there is anyone who can assist me in finding a solution for what seems to
be a simple case please assist.

Thank you!
pantherdev
1/23/2006 9:48:15 PM
Charles Parcell
1/30/2006 12:09:24 PM
This is past of a class that would have a property called _toggle which
indicates if the button is toggled on or not. This class also assumes
that you have a MC called button within which holds the different
graphical states of the button.

private var _toggle:Boolean;
private var button_mc:MovieClip;

public function thisButton(){
_toggle = false;
}

public function onPress(){
this.button_mc.gotoAndStop("down");
_toggle = !toggle;
}
public function onRelease(){
this.button_mc.gotoAndStop("over");
}
public function onRollOver(){
this.button_mc.gotoAndStop("over");
}
public function onRollOut(){
if(_toggle){
this.button_mc.gotoAndStop("over");
} else {
this.button_mc.gotoAndStop("up");
}
}

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