Informatica
In this walkthrough, you will perform the following tasks:
Bind using the curly brace syntax
Bind a static value from one component to another
Bind avariable value from one component to another
Steps
1. Open the Fundamentals_wt6.mxml file from the src folder at the root of the project.
Creating a data binding
2. Add a Labelcontrol with an id ofmyLabel and a text property set equal to This is a Label.
<mx:Label id ="myLabel" text="This is a Label"/)
3. Add another Label control with a text property bound to the width property of thelabel named
myLabel.
<mx:Label text="{myLabel.width}"/>
4. Run the application. You should see the Label containing text, and the width displayed below.
Binding to a dynamic value
5.Addan<mx:TextInput>tagwithan i d of mylnput.
<mx:TextInput id = "my Input"/>
6. Belowthe Textlnput, add a Label with a text property bound 1 mylnput. text.
<mx:Labeltext="{myInput.text}"/>
7. Run the application. As you type in the input field, you should see that binding dynamically alters the
text in the other Label.
ADOBE FLEX 3
Developing Rich Client Applications
Página 59de 274
Architecting an application with MXML components
In general, all your application code should not be in one monolithic file
A best practice is to break your application into multiple MXMLfiles
Breaking up your application into components has the following benefits
Allows multiple developers to work on the application
Makes it easier to maintain the application
Theapplication is more logically structured into smaller pieces
Enables parts of the application to be reused elsewhere
Using MXML components
When you separate your application into multiple MXML filesEach file is an “MXML component”
The main MXML application manages the individual components
Each component often represents a different state of the application
There can only be one...
Regístrate para leer el documento completo.