Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help

Status
Not open for further replies.

paulw1982

MIS
Aug 6, 2003
41
AU
I want to have buttons on my site which increase their size when the mouse is rolled over them (but increase slowly). I though I would have to use the _xscale and _yscale keywords within a for loop, but now I know it wont be possible that way.

Can anybody please give me some idea of how to achieve this?

Would be very grateful.


Paul
 
Stick your button inside a movieclip, give the clip the instance name 'myButton' and add this script to the main timeline:

Code:
checkButton = function () {
	// check if mouse is over button
	if (myButton.hitTest(_xmouse, _ymouse, true)) {
		// swell
		myButton._xscale += (myButton._xscale<maxScale) ? grow : 0;
	} else {
		if (myButton._xscale>minScale) {
			// shrink
			myButton._xscale -= grow;
		}
	}
	myButton._yscale = myButton._xscale;
};
// alter these values to get the effect you're looking for
grow = 3;
maxScale = 150;
minScale = 100;
//run the function
this.onEnterFrame = checkButton;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top