1.2. Tip to Remember

When not using Flash Builder or IntelliJ IDEA, leverage the Flex ANT Tasks, which are bundled with the free Flex 3.2 SDK, to compile Flex applications. When using ANT Tasks, you can avoid tediously specifying all necessary parameters on the command line.

When this compiled swf is accessed via a web browser (which hosts a Flash Player plug-in of version 9 and above), the initial screen shows up, as in Figure 1-3.

Figure 1.3. Figure 1-3

In the screen, I put in my name and click the Submit button, and I see the application greeting me by my name, as was expected. Figure 1-4 depicts this output.

Figure 1.4. Figure 1-4

Next, we refactor this simple application a bit just to emphasize the flexible data-binding aspects of Flex. The Submit button and the click handler are actually superfluous code and can be gotten rid of. The TextInput control can directly be bound to the Label that displays the output. The refactored code for the visual control takes the following form:

<mx:Label text="What's your name?"/>
<mx:TextInput id="textInput"/>
<mx:Label text="Hello, {textInput.text} !"/>

Actually, this code does not just represent the visual control but is pretty much the entire code. The only thing missing is the enclosing Application tags, which form the essential ...

Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.