Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 4613

# AS3 scalex on MouseEvent

I'm new to AS3 - I found some code in AS2 that I would like to make work.  I'm trying to scale up a button when the mouse is over.  When the mouse is off, I need it to scale back.  here's my code:

import fl.transitions.Tween;
import fl.transitions.easing.*;

homeButton.scalex = 1;
homeButton.scaley = 1;
function HomeOver(e:MouseEvent):void{
trace(homeButton.scalex);

var lngth:Number = 1.2;
var xscaleUp:Tween = new Tween(homeButton, "scalex", Elastic.easeOut, homeButton.scalex, 100, lngth, true);
var yscaleUp:Tween = new Tween(homeButton, "scaley", Elastic.easeOut, homeButton.scaley, 100, lngth, true);
}

function HomeOut(e:MouseEvent):void{
trace("Goodby");

var lngth:Number = 1.6;
var xscaleBack:Tween = new Tween(homeButton, "scalex", Elastic.easeOut, 100, 100, lngth, true);
var yscaleBack:Tween = new Tween(homeButton, "scaley", Elastic.easeOut, 100, 100, lngth, true);
}
stop();

I'm not sure what I'm doing wrong.  Any help would be appreciated!
0
steverguy
1 Solution

Commented:
Hi,

Well, the first thing is the quantities are scaleX and scaleY, so the case of X and  Y are important.

Second, the scales in AS3 are not based on 100, but 1.  1 represents a normal scale, 100 means 100 times normal size.

Third, your "HomeOut" event just sets the scale because your start and end values are the same.  If that's what you want, you don't need the tween.

Fourth, you misspelled "Goodbye" ;)

HTH
Gene
0

Author Commented:
:)  Thanks, it was the case issue.  scaleX not scalex.