
34
Chapter 2: Using MXML
<mx:dataProvider>
<mx:Array>
<mx:String>Dogs</mx:String>
<mx:String>Cats</mx:String>
<mx:String>Mice</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
</mx:VBox>
The following example shows an application that uses the MyComboBox component as a custom
tag. The value * assigns the
local
namespace to the current directory.
<?xml version="1.0"?>
<!-- MyApplication.mxml -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:local="*"
>
<mx:Panel title="My Application" marginTop="10" marginBottom="10"
marginLeft="10" marginRight="10" >
<local:MyComboBox/>
</mx:Panel>
</mx:Application>
The following figure shows the application rendered in a web browser window:
For more information about MXML components, see Chapter 15, “Building an Application with
Multiple MXML Files,” in
Developing Flex Applications
.
You can also define custom Flex components in ActionScript and the Flash MX 2004 authoring
tool. For more information, see
Chapter 3, “Using ActionScript.”
Using XML namespaces
In an XML document, tags are associated with a namespace. XML namespaces let you refer to
more than one set of XML tags in the same XML document. The
xmlns
property in an MXML
tag specifies an XML namespace. To use the default namespace, specify no prefix. To use
additional tags, specify a tag prefix and a namespace. For example, the
xmlns
property in the
following
<mx:Application>
tag indicates that tags in the MXML namespace use the prefix
mx:
.
The Universal Resource Identifier (URI) for the MXML namespace is
http://www.macromedia.com/2003/mxml.
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" >
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...