In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: flash on 2011-4-8

...
@author jc at bk-zen.com
Get Adobe Flash player
by bkzen 08 Apr 2011
/**
 * Copyright bkzen ( http://wonderfl.net/user/bkzen )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/a4Su
 */

// forked from bkzen's flash on 2011-4-8
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 = getColorTransform2(0xFF0000, 0.5);
        }
        
        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
            );
        }
        
        private function getColorTransform2(color: uint, percent: Number = 1.0): ColorTransform 
        {
            return new ColorTransform(
                1, 1, 1, 1,
                (((color >> 16 & 0xFF) << 1) - 0xFF) * percent,
                (((color >>  8 & 0xFF) << 1) - 0xFF) * percent,
                (((color >>  0 & 0xFF) << 1) - 0xFF) * percent
            );
        }
        
    }

}