
Basic MXML syntax
35
XML namespaces give you the ability to use custom tags that are not in the MXML namespace.
The following example shows an application that contains a custom tag called CustomBox. The
namespace value
containers.boxes.*
indicates that an MXML component called CustomBox
is in the containers/boxes directory.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:my="containers.boxes.*"
>
<mx:Panel title="My Application" marginTop="10" marginBottom="10"
marginLeft="10" marginRight="10" >
<my:CustomBox/>
</mx:Panel>
</mx:Application>
The containers/boxes directory can be a subdirectory of the directory containing the application
file, or it can be a subdirectory of one of the ActionScript classpath directories assigned in the
flex-config.xml file. If copies of the same file exist in both places, Flex uses the file in the
application file directory. The prefix name is arbitrary, but it must be used as declared.
When using a component contained in a SWC file, the package name and the namespace must
match, even though the SWC file is in the same directory as the MXML file that uses it. For more
information about SWC components, see
Developing Flex Applications
.
Basic MXML syntax
Most MXML tags correspond to ActionScript 2.0 classes or properties of classes. Flex parses
MXML tags and compiles a SWF file that contains the corresponding ActionScript objects.
ActionScript 2.0 is a new version of ActionScript that uses syntax based on the ECMAScript
Edition 4 proposal. ActionScript 2.0 includes the following features:
•
Formal class definition syntax
•
Formal packages structure
•
Typing of variables, parameters, and return values (compile-time only)
•
Implicit getters and setters that use the
get
and
set
keywords
•
Inheritance
•
Public and private members
•
Static members
•
Cast operator
For more information about ActionScript 2.0, see
Chapter 3, “Using ActionScript,” on page 43
.
Содержание FLEX-GETTING STARTED WITH FLEX
Страница 1: ...Getting Started with Flex...
Страница 4: ...4 Contents...
Страница 22: ...22 Chapter 1 Introducing Flex...