Scoping In Custom Components - Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

For example, the following example sets the
listener for the
scroll
the child
CheckBox
or
<?xml version="1.0"?>
<!-- mxml/MainEmptyFormProps.mxml-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="*">
<mx:Script>
<![CDATA[
import mx.events.ScrollEvent;
private function handleScrollEvent(event:ScrollEvent):void {
// Handle scroll event.
}
]]>
</mx:Script>
<MyComp:AddressForm horizontalPageScrollSize="25"
scroll="handleScrollEvent(event);"/>
</mx:Application>
To configure the children of a custom MXML component, you define new properties in the
MXML component, and then use those new properties to pass configuration information to
the component children. For more information, see
Components," on page

Scoping in custom components

Scoping is mostly a description of what the
application. In an
<mx:Script>
current scope. In the main application file, the file that contains the
the current scope is the Application object; therefore, the
Application object.
In an MXML component, Flex executes in the context of the custom component. The
current scope is defined by the root tag of the file. So, the
Application object, but to the object defined by the root tag of the MXML file.
For more information on scoping, see Chapter 4, "Using ActionScript," in Flex 2 Developer's
Guide.
event for your custom control, but you cannot specify properties for
TextInput
controls of the Form container:
91.
this
tag in an MXML file, the
horizontalPageScrollSize
Chapter 8, "Creating Advanced MXML
keyword refers to at any given point in your
keyword always refers to the
this
keyword refers to the
this
keyword refers not to the
this
Scoping in custom components
property and a
tag,
<mx:Application>
83

Advertisement

Table of Contents
loading

Table of Contents