Macromedia flex 2 Manual
34
Using ActionScript to Create Components
About scope
Scoping is mostly a description of what the
this
keyword refers to at any given point in your
application. In the main MXML application file, the file that contains the
<mx:Application>
tag, the current scope is the Application object and, therefore, the
this
keyword refers to the Application object.
In an ActionScript component, the scope is the component itself and not the application or
other file that references the component. As a result, the
other file that references the component. As a result, the
this
keyword inside the component
refers to the component instance and not the Flex Application object.
Nonvisual ActionScript components do not have access to their parent application with the
parentDocument
property. However, you can access the top-level Application object by using
the
mx.core.Application.application
property.
For more information on scope, see Chapter 4, “Using ActionScript,” in Flex 2 Developer’s
Guide.
Guide.