Jump to content
Search Community

simulate mouseover using frames

squibn test
Moderator Tag

Recommended Posts

Hi there,

 

Is this something that can be achieved using TweenMax, and if so whats would be my best route to go...

What I'm wanting to do is simulate a mouse cursor moving over a button so that it changes from an arrow to the pointer when it travels over a particular movieclip as if to simulate someone moving their cursor over a button.

 

There would be no actual user interaction as its all automated to simulate a "How to use" animation.

 

I was planning on using TweenMax's bezierThrough to achieve the movement of a MovieClip (the cursor) with two frames inside, one of the arrow, and the other of the pointer, this would then travel across the screen and when it entered a particular MovieClip would go to frame two (which would make the arrow change to the pointer) and then when it went back out of the MovieClip go back to frame one (thus change back to the arrow.)..so it would look like an animation of a mouse cursor going over a button.

 

I hope I'm being clear in what I'm trying to achieve, if I'm not then I'll try explain further!!

 

I'm just not sure what would be the best tool to use in this amzing tweening engine!

 

Cheers,

Squibn

Link to comment
Share on other sites

You could use an onUpdate during the tween to call a function that tests whether or not your cursor MovieClip is over the top of whatever and toggle the frame accordingly. Sorta like:

 

TweenMax.to(cursor, 10, {bezierThrough:[...], onUpdate:checkRollover});
function checkRollover():void {
   if (cursor.hitTestObject(YOUR_OBJECT)) {
       cursor.gotoAndStop(2);
   } else {
        cursor.gotoAndStop(1);
   }
}

 

You could add some more conditional logic in there to skip the gotoAndStop() if it's already on that frame in order to improve performance a bit, but hopefully this demonstrates the concept.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...