Creating an Object: var variableName:datatype = new ClassName(); : Object « Class « Flash / Flex / ActionScript






Creating an Object: var variableName:datatype = new ClassName();

 

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

        var oFirstObject:Object = new Object();
        trace(oFirstObject instanceof Object);  // Displays: true
        var sTitle:String = new String("ActionScript Bible");
        trace(sTitle instanceof String);  // Displays: true
    }
  }
}

        








Related examples in the same category

1.Using the dot (.) operator to create the same variable causes an error because it violates the syntactic rules for identifiers:
2.Accessing Object Properties
3.Accessing Object Methods
4.Using Objects as Associative Arrays
5.Testing for Existence
6.Use this operator to investigate instances of classes for methods and public properties
7.Removing Properties