A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: mouseover/mouseout looping

  1. #1
    Senior Member
    Join Date
    Aug 2006
    Posts
    293

    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?

    ;-)

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Perhaps you could make something of this
    PHP Code:
    clip.stop();

    var 
    doTimeCheck:Number setInterval(checkMouse10);

    function 
    checkMouse():Void
    {
        if (
    button.hitTest(_xmouse_ymousetrue))
        {
            
    clip.play();
        }
        else
        {
            if (
    clip._currentframe >= clip._totalframes)
            {
                
    clip.gotoAndStop(1);
                
    //clearInterval(doTimeCheck);
            
    }
        }

    that is without seeing your set up

  3. #3
    Senior Member
    Join Date
    Aug 2006
    Posts
    293
    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

    ;-)

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Just remove the clip parts
    PHP Code:
    stop();

    var 
    doTimeCheck:Number setInterval(checkMouse10);

    function 
    checkMouse():Void
    {
        if (
    button.hitTest(_xmouse_ymousetrue))
        {
            
    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.

  5. #5
    Senior Member
    Join Date
    Aug 2006
    Posts
    293
    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

  6. #6
    Senior Member
    Join Date
    Aug 2006
    Posts
    293
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center