jan_flanders

Untitled

May 8th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package;
  2. import flash.display.MovieClip;
  3. import flash.Lib;
  4.  
  5. class Main extends MovieClip
  6. {
  7.     public static function main()
  8.     {
  9.         getEvents(new flash.text.TextField());
  10.     }
  11.     public static function getEvents(tf:Dynamic)
  12.     {
  13.         if (Std.is(tf, flash.events.IEventDispatcher))
  14.         {
  15.             test1(tf);
  16.             test2(tf);
  17.             test3(tf);
  18.         }
  19.     }
  20.     public static function test1(tf)
  21.     {
  22.         trace(tf);//[object TextField]
  23.         trace(Std.is(tf,String));// true
  24.         if (1==2)
  25.         {
  26.             var s:String = tf;
  27.         }
  28.     }
  29.     public static function test2(tf)
  30.     {
  31.         trace(tf);//0
  32.         trace(Std.is(tf,Int));// true
  33.         if(1==2)
  34.         {
  35.             var i:Int = tf;
  36.         }
  37.     }
  38.     public static function test3(tf)
  39.     {
  40.         trace(tf);//true
  41.         trace(Std.is(tf,Bool));// true
  42.         if(1==2)
  43.         {
  44.             var i:Bool = tf;
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment