Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 21

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

Advertisement

The StateComboBox.mxml file specifies the ComboBox control as its root tag, so you can
reference all of the properties of the ComboBox control in the MXML tag of your custom
component, or in the ActionScript specified in an
following example specifies the
event for your custom control:
ComboBox.close
<?xml version="1.0"?>
<!-- intro/MyApplicationProperties.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*">
<mx:Script>
<![CDATA[
import flash.events.Event;
private function handleCloseEvent(eventObj:Event):void {
// ...
}
]]>
</mx:Script>
<MyComp:StateComboBox rowCount="5" close="handleCloseEvent(event);"/>
</mx:Application>
For more information on MXML components, see
on page
77.
Creating ActionScript components
You create ActionScript components by defining ActionScript classes. You can create the
following types of components in ActionScript:
User-interface, or visual, components
processing logic and visual elements. You create custom user-interface components to modify
existing behavior or add new functionality to the component. These components usually
extend the Flex component hierarchy. You can extend from the
the Flex components, such as Button, ComboBox, or DataGrid. Your custom ActionScript
component inherits all of the methods, properties, events, styles, and effects of its superclass.
Nonvisual components
several types of nonvisual components that you can create, including formatters, validators,
and effects. You create nonvisual components by creating a subclass from the Flex component
hierarchy. For validators, you create subclasses of the
subclasses of the
Formatter
ComboBox.rowCount
User-interface components contain both
Nonvisual components define nonvisual elements. Flex includes
class; and for effects, you create subclasses of the
tag. For example, the
<mx:Script>
property and a listener for the
"Creating Simple MXML Components"
UIComponent
Validator
class; for formatters you create
Creating custom components
class, or any of
Effect
class.
21

Advertisement

Table of Contents
loading

Table of Contents