Convert class to the more general type without writing any explicit code. : Class « Class « Flash / Flex / ActionScript






Convert class to the more general type without writing any explicit code.

 

package{
  import flash.display.Sprite;
  import flash.geom.Rectangle;
  public class Main extends Sprite{
    public function Main(){

        var square:Rectangle = new Rectangle();
        var array:Array = ["hello", "world"];
        var obj:Object;
        while (obj = array.shift())
        {
            trace(obj);
        }
        
        
        var str:String = "";
        if (!str) str = "Default";
        trace(str); //Default
        
        for (var i:int = 1; i < 4; i++)
        {
            trace(i, (i % 2)? "odd" : "even");
        }
    }
  }
}

        








Related examples in the same category

1.Define a class
2.Define class with properties
3.Class Objects