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

Chapter 10. Extending ActionScript > Extending Your Environment

Extending Your Environment

Flash MX contains a new object called _global, which holds the core ActionScript objects, such as String and Date. The nice thing about _global is that its properties and methods are accessible to every timeline and movie clip within a project. This means that by adding our own property or method to _global, we're able to extend the Flash environment to complement the core functionality.

Imagine you're trying to solve a problem with your Flash project. You've placed trace() statements throughout the code to determine how often a particular piece of code is called. The trace() function doesn't support a way of displaying the current time along with your trace message. But that would certainly help! The following code demonstrates how to add a new log() method that displays both a timestamp and your message.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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