flash on 2010-12-3

by uwi
♥0 | Line 37 | Modified 2010-12-03 17:07:33 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.TextField;

    public class Test extends Sprite {
        private var _tf : TextField;

        public function Test() {
            _tf = new TextField();
            _tf.width = 465;
            _tf.height = 465;
            addChild(_tf);

            test(undefined);
            test(null);
            test(new C(_tf));
        }
        
        private function test(c : *) : void
        {
//            try{c.func();}catch(e:*){}
            c is C && c.func();
        }


        private function tr(...o : Array) : void
        {
            _tf.appendText(o + "\n");
        }
    }
}

class C
{
    import flash.text.TextField;
    private var _tf : TextField;
    
    public function C(tf : TextField)
    {
        _tf = tf;
    }
    
    public function func() : void
    {
        _tf.appendText("nya-!");
    }
}