Use this operator to investigate instances of classes for methods and public properties : Object « Class « Flash / Flex / ActionScript






Use this operator to investigate instances of classes for methods and public properties

 


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

         var sprite:Sprite = new Sprite();
         trace("alpha" in sprite); // Displays true
         trace("getChildAt" in sprite); // Displays true
         var person:Person = new Person("Ben");
         trace("name" in person); // Displays true
         trace("SSN" in person); // Displays false

    }
  }
}
 class Person
 {
     public var name:String;
     private var SSN:Number;
     public function Person(name:String)
     {
         this.name = name;
     }
 }

        








Related examples in the same category

1.Creating an Object: var variableName:datatype = new ClassName();
2.Using the dot (.) operator to create the same variable causes an error because it violates the syntactic rules for identifiers:
3.Accessing Object Properties
4.Accessing Object Methods
5.Using Objects as Associative Arrays
6.Testing for Existence
7.Removing Properties