flash on 2013-1-12

by hemingway
♥0 | Line 93 | Modified 2013-01-15 01:41:08 | MIT License
play

ActionScript3 source code

/**
 * Copyright hemingway ( http://wonderfl.net/user/hemingway )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/h9ct
 */

package
{
    import flash.display.*;
    import flash.events.*;
    import flash.utils.*;
    import flash.geom.*;
    
    [SWF(frameRate = 60, width = 465, height = 465)]
    public class FlashTest extends Sprite
    {
        public function FlashTest()
        {
            addEventListener(Event.ADDED_TO_STAGE, addedToStage);
            
            
        }
        
        public function _init() :void
        {
            graphics.clear();
            graphics.lineStyle(1, 0, 0.75);
            graphics.drawRect(0, 0, 464, 464);
        }
        
        public function addedToStage($e:Event) :void
        {       
            Buffer.buildContext(this);
            
            _init();
            
            Buffer.enumTest();
        }
    }
}

import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;

class Buffer
{
    public static var outputMain :Output;
    public static var outputTwo :Output;
    
    public static var context :Object;
    public static var contextList :Array;
    
    public static function buildContext($c:Object) :void
    {
        outputMain = new Output("1");
        
        context = $c;
        contextList = [outputMain];
        
        for (var $:int; $ < contextList.length; $++)
            {$c.addChild(contextList[$])}
    }
    
    public static function enumTest() :void
    {
        var $start:Number = getTimer();
        
        for (var i:int = 0; i == 1; i++)
            {}
            

    }

}

class Output extends TextField
{
    private var textFormat :TextFormat;
    
    protected var _content :String;
    protected var _x :Number;
    protected var _y :Number;
    protected var _font :String;
    
    public function Output($content:String, $x:Number = 1, $y:Number = 0, $font:String = "Helvetica")
    {
        addEventListener(Event.ADDED_TO_STAGE, addedToStage);
        
        _content = $content;
        _x = $x;
        _y = $y;
        _font = $font;
        
        multiline = true;
        autoSize = "left";
        selectable = mouseEnabled = false;
        antiAliasType = AntiAliasType.ADVANCED;
    }
    
    public function _init() :void
    {
        text = _content;
        x = _x;
        y = _y;
        
        textFormat = new TextFormat(_font);
        setTextFormat(textFormat);
    }
    
    public function addedToStage($e:Event) :void
    {
       removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
       
       _init(); 
    }
    
    public function get font() :String
    { return _font }
    public function get nWidth() :Number
    { return width }
    
    public function set font($:String) :void
    { _font = $; _init(); }
    public function set content($:String) :void
    { _content = $; _init(); }
}