flash on 2011-4-8
...
@author jc at bk-zen.com
/**
* Copyright bkzen ( http://wonderfl.net/user/bkzen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/xi86
*/
package
{
import flash.display.AVM1Movie;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.ColorTransform;
/**
* ...
* @author jc at bk-zen.com
*/
public class Test35 extends Sprite
{
private var sp:Sprite;
public function Test35()
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e: Event = null): void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
//
addChild(sp = new Sprite());
sp.graphics.beginFill(0xFFFFFF);
sp.graphics.drawRect(0, 0, 100, 100);
sp.transform.colorTransform = getColorTransform(0xFF0000);
}
private function getColorTransform(color: uint): ColorTransform
{
var r: uint = (color >> 0x10 & 0xFF);
var g: uint = (color >> 0x08 & 0xFF);
var b: uint = (color >> 0x00 & 0xFF);
return new ColorTransform(
r / 0xFF, g / 0xFF, b / 0xFF, 1
);
}
}
}