-
mouseover/mouseout looping
hi all,
hoping that someone can give me the answer to this problem that i have.
i have a very basic animation (20 frames) which i want to only play/loop when the mouse rolls over the invisible button which is overlaying the animation area...
but... for the life of me i can't remember the correct action script that will tell the movie to play and loop when mouse is over the button - and when the mouse moves away/out from the button to keep playing until it reaches frame 20 and then just stop back on frame 1...
do you know what i mean? so on mouseover loop the animation - but on mouse out from the button play the remainder of the timeline and 'then'
stop...
in my original timeline i had a stop action on the first frame and a goto and play frame 2 action on frame 20 - with the button simply having the action rollover = play and rollout = stop... which was okay but i want the animation to play the remaining frames regardless of how many are left on mouse out...
anyone know the easiest way of doing this please?
;-)
-
.
Hi,
Perhaps you could make something of this
PHP Code:
clip.stop();
var doTimeCheck:Number = setInterval(checkMouse, 10);
function checkMouse():Void
{
if (button.hitTest(_xmouse, _ymouse, true))
{
clip.play();
}
else
{
if (clip._currentframe >= clip._totalframes)
{
clip.gotoAndStop(1);
//clearInterval(doTimeCheck);
}
}
}
that is without seeing your set up
-
hi fruitbeard,
thanks for the reply - appreciate it ;-)
i was hoping for something simpler - as the end product will run as a swiffy object - so that is why i was trying to keep it frame/timeline/button based...
i remember doing something similar many many moons ago - but have no idea what it was or how i did it!!!!
but grateful for you taking time to reply amigo
;-)
-
.
Hi,
Just remove the clip parts
PHP Code:
stop();
var doTimeCheck:Number = setInterval(checkMouse, 10);
function checkMouse():Void { if (button.hitTest(_xmouse, _ymouse, true)) { play(); } else { if (_currentframe >= _totalframes) { gotoAndStop(1); } } }
couldnt be more simple really, I just tested it using swiffy too.
I admit there are other ways of doing it too.
-
okay - i'll give it a whirl - that is great !!! and very kind of you to help me out...
i agree there must be other ways - but... if this does the job then that's the one for me!!! lol!
thanks fruitbeard
-
works a treat!!!!!!!!!! whoop whoop!!!! thankyou
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|