Color Transform

import fl.motion.Color;
var square:Sprite = new Sprite();
square.graphics.beginFill(0x000000);
square.graphics.drawRect(100, 100, 100, 100);
addChild(square);
square.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
square.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
function onMouseOver (e:MouseEvent):void
{
var c:Color = new Color();
c.setTint (0x929218, 1);
square.transform.colorTransform = c;
}
function onMouseOut (e:MouseEvent):void
{
var c:Color = new Color();
c.setTint (0, 0);
square.transform.colorTransform = c;
}


CodeLink

http://codes.creativebrain.ca

0 comments:

Post a Comment