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

flash on 2011-7-18

Get Adobe Flash player
by kihon 18 Jul 2011
    Embed
package
{
    import flash.display.Sprite;
    import flash.geom.Rectangle;
    
    public class Main extends Sprite
    {
        public static const COLORS:Array = [0xFF0000, 0xFF8400, 0xFFFF00, 0xB5FF00, 0x00D900, 0x00C399, 0x0000FF, 0xC600CE, 0xD6003D];
        public static const SIZE:int = 20;
        
        public function Main()
        {
            var original:Sprite = createGrid();
            var hScaleSprite:Sprite = createGrid();
            var vScaleSprite:Sprite = createGrid();
            var hvScaleSprite:Sprite = createGrid();
            
            hScaleSprite.scaleX = 2;
            vScaleSprite.scaleY = 2;
            hvScaleSprite.scaleX = hvScaleSprite.scaleY = 2;
            
            hScaleSprite.x = vScaleSprite.x = hvScaleSprite.x = 200;
            vScaleSprite.y = 100;
            hvScaleSprite.y = 260;
        }
        
        private function createGrid():Sprite
        {
            var sprite:Sprite = new Sprite();
            addChild(sprite);
            
            for (var y:int = 0; y < 3; y++)
            {
                for (var x:int = 0; x < 3; x++)
                {
                    var color:int = COLORS[y * 3 + x];
                    sprite.graphics.beginFill(color);
                    sprite.graphics.drawRect(SIZE * x, SIZE * y, SIZE, SIZE);
                    sprite.graphics.endFill();
                }
            }
            sprite.scale9Grid = new Rectangle(SIZE, SIZE, SIZE, SIZE);
            return sprite;
        }
    }
}