FORUMS: list search recent posts

.onRollOver problem

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dan Flynn
.onRollOver problem
on May 3, 2009 at 9:24:41 pm

Hi,

I'm pretty new to Flash and I'm working in AS2 for a college project.
Basically I want a clip to play from a .onRollOver, but only if the mouse hovers on it for 1 second.

I've tried a function wait() but the clip still plays if the mouse just grazes it, just a second later.

any ideas? heres the code

main_mc.genreactionlist_mc.onRollOver = function(){
main_mc.genreactionlisthover_mc.gotoAndStop(2);

function wait(){
minivid_mc.gotoAndPlay(2);
minivid_mc.infidel_flv._visible =true;
minivid_mc.infidel_flv.play();
clearInterval(myTimer); }

myTimer = setInterval(wait, 1000); // calls the function after 1 second but I want it to call the fucntion after 1 second of hovering
}


Return to posts index

Pieter Helsen
Re: .onRollOver problem
on May 4, 2009 at 9:11:27 am

Use setTimeout() instead. It works exactly the same way, but only calls the function once, after the specified delay.

Also, don't declare functions inside functions. Declare the wait function outside of the brackets... Like so:

main_mc.genreactionlist_mc.onRollOver = function(){
main_mc.genreactionlisthover_mc.gotoAndStop(2);

setTimeout(wait, 1000); // calls the function after 1 second but I want it to call the fucntion after 1 second of hovering
}

function wait(){
minivid_mc.gotoAndPlay(2);
minivid_mc.infidel_flv._visible =true;
minivid_mc.infidel_flv.play();
}

Kind regards,
Pieter

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.


Return to posts index

Dan Flynn
Re: .onRollOver problem
on May 4, 2009 at 10:19:00 am

Hey thanks a million, that worked perfectly!!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]