Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
WhiteDesign

itty bitty tweeny button [SOLVED]

Recommended Posts

Hello!!! Another question! Sorry about the subject title! Just couldn't resist!

 

I've created a simple button but I want to want to add a 'hit' area and I just can't fathom out how to do it.

My button is 100px x 100px but expands to 200 x 200 when the mouse rolls over.

I want the button to tween back to it's original size when the mouse moves away from the 100 x 100 area,

not wait until it leaves the roll over 200 x 200 area!

 

		mc.addEventListener(MouseEvent.ROLL_OVER, overThree);
		mc.addEventListener(MouseEvent.ROLL_OUT, outThree);
		TweenLite.to(mc, 0, {autoAlpha:0.5});

		function overThree(evt:MouseEvent):void {
			TweenLite.to(mc, 1, {setSize:{width:200, height:200}, autoAlpha:1});
			trace("button THREE works");
		}
		function outThree(evt:MouseEvent):void {
			TweenLite.to(mc, 1, {setSize:{width:100, height:100}, autoAlpha:0.5});
			trace("button THREE works");
		}

 

Thanks!!!!

Link to comment
Share on other sites

I'd put a transparent 100x100 Sprite in front of your object and add your event listeners to that. Or put it behind and set mouseEnabled to false on your object. Either way should work.

Link to comment
Share on other sites

Thanks Jack!!!

It wasn't really a Greensock question was it... so thank you so much for helping!!

I was going slightly crazy!

 

Louisa :D

Link to comment
Share on other sites

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.
×