196
Creating Template Components
The following example shows an application that uses a template component called
MyTemplateComponent:
<?xml version="1.0"?>
<!-- templating/MainTemplateButton.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="myTComp1">
<MyComp:topRow>
<mx:Label text="top component"/>
</MyComp:topRow>
<MyComp:bottomRow>
<mx:Button label="Button 1"/>
<mx:Button label="Button 2"/>
<mx:Button label="Button 3"/>
</MyComp:bottomRow>
</MyComp:MyTemplateComponent>
</mx:Panel>
</mx:Application>
The MyTemplateComponent takes two properties:
■
The topRow property
specifies the single Flex component that appears in the top row of
the
VBox
container.
■
The bottomRow property specifies one or more Flex components that appear along the
bottom row of the VBox container.
The implementation of the MyTemplateComponent consists of a VBox container that
displays its children in two rows. The following image shows the output of this application:
Содержание FLEX 2 - CREATING AND EXTENDING COMPONENTS
Страница 1: ...Creating and Extending Flex 2 Components Adobe Flex 2...
Страница 6: ...6 Contents...
Страница 10: ...10 About Flex Documentation...
Страница 12: ......
Страница 24: ...24 Creating Flex Components...
Страница 74: ...74 Compiling Components...
Страница 76: ......
Страница 118: ...118 Creating Advanced MXML Components...
Страница 120: ......
Страница 182: ...182 Creating Advanced Visual Components in ActionScript...
Страница 194: ...194 Creating Custom Style Properties...
Страница 204: ...204 Creating Template Components...
Страница 206: ......
Страница 216: ...216 Creating Custom Formatters...
Страница 254: ...254 Index...