Implementing A Template Component - 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

The implementation of the topRow and bottomRow properties lets you specify any Flex
component as a value, as the following example shows:
<?xml version="1.0"?>
<!-- templating/MainTemplateLink.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*"
height="700" width="700">
<mx:Panel paddingTop="10" paddingBottom="10"
paddingRight="10" paddingLeft="10">
<MyComp:MyTemplateComponent id="myTComp2">
<MyComp:topRow>
<mx:TextArea text="top component"/>
</MyComp:topRow>
<MyComp:bottomRow>
<mx:LinkButton label="Link 1"/>
<mx:LinkButton label="Link 2"/>
<mx:LinkButton label="Link 3"/>
</MyComp:bottomRow>
</MyComp:MyTemplateComponent>
</mx:Panel>
</mx:Application>
In this example, the top component is a
two
LinkButton
controls.

Implementing a template component

The section
"About template components" on page 195
component named MyTemplateComponet. Flex provides you with two primary ways to
create template components:
Create properties with general data types, such as
Create properties with the type IDeferredInstance.
The following sections describes these methods.
Using general data types in a template component
This section shows one implementation of the component MyTemplateComponent shown in
the section
"About template components" on page 195
and bottomRow to be of type UIComponent. Users of the component can then specify any
object to these properties that is either an instance of the UIComponent class, or an instance
of a subclass of UIComponent.
TextArea
control, and the bottom components are
shows an example of a template
UIComponent
by defining the properties topRow
Implementing a template component
or
Container
197

Advertisement

Table of Contents
loading

Table of Contents