Using the as Operator to Cast to Date and Array : As : Statement Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Statement » As »

 

Using the as Operator to Cast to Date and Array


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var numbers:Array = [1,2,3]
        output(numbers);

    }
    public function output (msg:Object):void {
      if (msg is String) {
        trace(msg);
      }
    
      if (msg is Array) {
        var arr:Array = msg as Array;  // "Cast" to  Array  here    
        trace(arr.join("n"));
      }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Statement
» As