home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2012 April / ME_04_2012.iso / Video-Tutorial / iPhoto / media / player.swf / scripts / mx / utils / ArrayUtil.as next >
Encoding:
Text File  |  2011-11-11  |  950 b   |  46 lines

  1. package mx.utils
  2. {
  3.    import mx.core.mx_internal;
  4.    
  5.    use namespace mx_internal;
  6.    
  7.    public class ArrayUtil
  8.    {
  9.       mx_internal static const VERSION:String = "4.5.0.20967";
  10.       
  11.       public function ArrayUtil()
  12.       {
  13.          super();
  14.       }
  15.       
  16.       public static function toArray(param1:Object) : Array
  17.       {
  18.          if(param1 == null)
  19.          {
  20.             return [];
  21.          }
  22.          if(param1 is Array)
  23.          {
  24.             return param1 as Array;
  25.          }
  26.          return [param1];
  27.       }
  28.       
  29.       public static function getItemIndex(param1:Object, param2:Array) : int
  30.       {
  31.          var _loc3_:int = int(param2.length);
  32.          var _loc4_:int = 0;
  33.          while(_loc4_ < _loc3_)
  34.          {
  35.             if(param2[_loc4_] === param1)
  36.             {
  37.                return _loc4_;
  38.             }
  39.             _loc4_++;
  40.          }
  41.          return -1;
  42.       }
  43.    }
  44. }
  45.  
  46.