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

flash actionscript : on (rollOver) - loop action


mr.nazarko
7/9/2006 11:34:39 PM
hey ,

is it possible to loop an action activated by a rollover?
my current script will only run once...

how do you set up an "if" statement... so that when rolling over a button, an
action will loop until i rollout?

any help is appreciated

thanks,
nazarko


urami_
7/10/2006 12:00:00 AM


[quoted text, click to view]

bit too general, you will need to show us what action you are trying to loop


--
Regards

Urami


--



Happy New Year guys - all the best there is in the 2006 :)




<urami>
http://www.Flashfugitive.com
</urami>

<web junk free>
http://www.firefox.com
mr.nazarko
7/10/2006 12:37:17 AM
hey
thanks!

here is the code im trying to loop....


on (rollOver) {
if (_root.mainVar == 0) {
homeX = (-_root._xmouse*2.2)+1300;
} else {
homeX = (-_root.mainVar*2.2)+1300;
}
thisX = grass._x;
diffX = homeX-thisX;
if (_root.mainVar == 0) {
moveX = diffX/60;
} else {
moveX = diffX/40;
}
grass._x = thisX+moveX;

}
and ive posted a rough example

http://www.popmontreal.com/TEST/

the background is the effect im trying to achieve...

also, i just realized im going to have a button overlaying another button...
is it possible to have both active...
or does the large rollover cancel out the imbedded ones ?

thanks !
anton


CJ Dennis
7/10/2006 1:55:44 AM
on (rollOver) executes only once whenever the mouse hits the object, not
continuously. You would need to set up a condition [e.g. myButtonActive=true;]
that you then check in _root.onEnterFrame [e.g. if (myButtonActive) {...}].
Your condition will then be checked 12 times a second or whatever value you
have set for fps. Make sure you remove the condition when you roll out [e.g.
myButtonActive=false;].
Only one of your buttons can receive on (rollOver) at a time. I think you can
call your event from within your code but I can't check this right now. Maybe
something like

mySecondButton.onRollOver();
AddThis Social Bookmark Button