PDA

View Full Version : how to change a state button by actionscript


innermond
02-08-2004, 02:31 PM
I built a button and I need to simulate rollover effect by actionscript
to trigger an action I did

myButton.onRollOver=true;

but the button doesn't respond visual

Is there something to do except building a more complex button using movieclips?
Thanks in advance

oldnewbie
02-08-2004, 09:43 PM
...a more complex button using movieclips!

splict
02-08-2004, 09:52 PM
:D

innermond, check out MovieClip.onRollOver or Button.onRollOver in the ActionScript Dictionary section of the help files. It explains how you would actually assign a function to be executed to myButton.onRollOver not a Boolean value (true or false) as in your example.

So that is how you would do it with actionscript - that and the function to create the desired effect. This is only necessary if you want to go beyond regular buttons, which have a RollOver frame, or button components, though.

-splict

innermond
02-09-2004, 01:51 AM
the code:

btns[i].onRollOver=function(){
if(interv) _root.onMouseMove=function(){clearInterval(interv) };
_parent.slideTo(1*this._name.substr(3,(this._name. length-3)));
}


the problem:
there is no problem to trigger de actionscript but the button doesn't respond visual as is the case when you really pass over it with the mouse.

I tried btns[i].gotoAndPlay("Over");

I guess there is no chance to do it then using a "with movieclip" button

the link
http://www.mob.ro/btn/slide120x400.swf
see the bottom row of buttons they are not responding visual when the rollover event is triggered by actionscript
when the event is fired by mouse it's ok

thanks for responses

oldnewbie
02-09-2004, 02:23 AM
Didn't I say movie clip?

Since your buttons are all alike and your over state the same, it's merely a question of moving a movie clip (a 1 frame exact replica of your over state) on the y axis to the coordinates of each button.
The movie clip is set to be invisible to start with, and as soon as one button is rolled over, made visible and positioned over the rolled over button itself.

innermond
02-09-2004, 02:38 AM
that's a solution oldnewbie but, just for my knowledge, it's not posible to treat a standard button as a movieclip to control its states by "moving" on timeline?
or a button timeline is not the same as a movieclip timeline...

oldnewbie
02-09-2004, 08:54 AM
To my knowledge, you can't target a button's timeline with actionscript.

innermond
02-09-2004, 11:23 AM
http://www.mob.ro/
I aplied sugested solution
thanks

XToXicDeViLX
04-09-2010, 12:52 PM
YES U CAN CHANGE FORCE THE CHANGE OF STATE OF YOUR BUTTONS, using as3

for example you got a button named "btn"

then you want to ( for example ) change your UP state to OVER state

your code will be

btn.upState = btn.overState;


hope this helps;)

tacos
04-12-2010, 01:19 AM
YES U CAN CHANGE FORCE THE CHANGE OF STATE OF YOUR BUTTONS, using as3

for example you got a button named "btn"

then you want to ( for example ) change your UP state to OVER state

your code will be

btn.upState = btn.overState;


hope this helps;)

Not really, 'cause this is not an AS3.0 forum, but an AS2.0 one. :p