flash on 2011-2-4

by Nek
♥0 | Line 31 | Modified 2011-02-04 22:45:00 | MIT License
play

ActionScript3 source code

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

package {
    import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public var txt:TextField;
        public function FlashTest() {
        txt = new TextField();
        addChild(txt);
            
        trace(typeOf(1));
        trace(typeOf(1.1));
        trace(typeOf(0));
        trace(typeOf(-2));
        trace(typeOf("a"));
        trace(typeOf([]));
        trace(typeOf(true));
        trace(typeOf(false));
        trace(typeOf(null));
        trace(typeOf({}));
            
        }
        public function trace(s:String):void {
            txt.appendText(s);
            txt.appendText("\n");
        }
        
        public function typeOf(o:*):String {
            if (o is null) return 'null';
            var type:String = typeof o;
            if (o is Array) return 'array';
            return type;
        }


    }
}