• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Objects and Classes > Using Standalone Object Instances as Associat...

12.6. Using Standalone Object Instances as Associative Arrays

As we saw earlier, ActionScript leniently allows methods to assign new properties to objects. In fact, ActionScript is even more flexible than that—it allows any code to create a new property or method on a single object instance (rather than on all instances of a class). For example, the following code creates an instance, obj, of the generic Object class and immediately assigns it the new properties x (set to 10) and y (set to 20):

var obj = new Object( );
obj.x = 10;
obj.y = 20;


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint