SHOW:
|
|
- or go back to the newest paste.
| 1 | package; | |
| 2 | import flash.display.MovieClip; | |
| 3 | import flash.events.IEventDispatcher; | |
| 4 | import flash.Lib; | |
| 5 | import flash.text.TextField; | |
| 6 | ||
| 7 | class Main extends MovieClip | |
| 8 | {
| |
| 9 | - | getEvents(new flash.text.TextField()); |
| 9 | + | |
| 10 | {
| |
| 11 | var tf:TextField = new TextField(); | |
| 12 | getEvents(tf); | |
| 13 | - | if (Std.is(tf, flash.events.IEventDispatcher)) |
| 13 | + | |
| 14 | public static function getEvents(tf:Dynamic) | |
| 15 | {
| |
| 16 | if (Std.is(tf, IEventDispatcher)) | |
| 17 | {
| |
| 18 | test1(tf); | |
| 19 | test2(tf); | |
| 20 | test3(tf); | |
| 21 | } | |
| 22 | - | trace(tf);//[object TextField] |
| 22 | + | |
| 23 | - | trace(Std.is(tf,String));// true |
| 23 | + | |
| 24 | - | if (1==2) |
| 24 | + | |
| 25 | if (Std.is(tf,String)) | |
| 26 | {
| |
| 27 | trace("tf is a String");
| |
| 28 | var s:String = tf; | |
| 29 | } | |
| 30 | } | |
| 31 | - | trace(tf);//0 |
| 31 | + | |
| 32 | - | trace(Std.is(tf,Int));// true |
| 32 | + | |
| 33 | - | if(1==2) |
| 33 | + | if(Std.is(tf,Int)) |
| 34 | {
| |
| 35 | trace("tf is an Int");
| |
| 36 | var i:Int = tf; | |
| 37 | } | |
| 38 | } | |
| 39 | public static function test3(tf) | |
| 40 | - | trace(tf);//true |
| 40 | + | |
| 41 | - | trace(Std.is(tf,Bool));// true |
| 41 | + | if(Std.is(tf,Bool)) |
| 42 | - | if(1==2) |
| 42 | + | |
| 43 | trace("tf is a Bool");
| |
| 44 | - | var i:Bool = tf; |
| 44 | + | var b:Bool = tf; |
| 45 | } | |
| 46 | } | |
| 47 | } |