40
Chapter 2: Using MXML
Compiler tags
Compiler tags
are tags that do not directly correspond to ActionScript objects or properties. The
names of the following compiler tags have just the first letter capitalized:
•
<mx:Binding>
•
<mx:Effect>
•
<mx:Model>
•
<mx:Script>
•
<mx:Style>
•
<mx:Metadata>
The following compiler tags are in all lowercase letters:
•
<mx:operation>
•
<mx:request>
•
<mx:method>
•
<mx:arguments>
Identifier properties on MXML tags
With a few exceptions (see
“MXML tag syntax” on page 41
), a tag that corresponds to a
component has an optional
id
property, which must be unique within the MXML file. If a tag
has an
id
property, you can reference the corresponding object in ActionScript.
In the following example, results from a web service request are traced in the
writeToLog
function:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
...
<mx:VBox>
<mx:TextInput
id="myText" text="Hello World!"
/>
<mx:Button id="mybutton" label="Get Weather" click="
writeToLog();
"/>
</mx:VBox>
<mx:Script>
<![CDATA[
function writeToLog()
{
trace(myText.text);
}
]]>
</mx:Script>
</mx:Application>
Because each
id
value in an MXML file is unique, all objects in a file are part of the same flat
namespace. You do not qualify an object by referencing its parent with dot notation, as in
myVBox.myText.text.
Summary of Contents for FLEX-GETTING STARTED WITH FLEX
Page 1: ...Getting Started with Flex...
Page 4: ...4 Contents...
Page 22: ...22 Chapter 1 Introducing Flex...