To specify component namespaces in your code:
•
Depending on the type and location of the component you want to insert, specify the
namespace as follows:
Standard Macromedia controls and containers
control or container, you don't need to specify a namespace. The namespace for all
Macromedia components is http://www.macromedia.com/2003/mxml/ and is specified in the
<mx:Application>
For example, if you want to insert a ComboBox control, which is a Macromedia component,
enter the ComboBox tag between the opening and closing
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:ComboBox/>
</mx:Application>
You can omit the
property name (you use
identical to the previous one, except that the prefix is omitted from the component tag:
<Application xmlns="http://www.macromedia.com/2003/mxml">
<ComboBox/>
<Application>
Custom MXML and ActionScript components
ActionScript component, the namespace is defined by the location of the component file in
the application's root folder on the server.
For example, if you write a custom MXML component called myButton.mxml and save it on
the Flex server in the assets/components/mycontrols subfolder in your application root folder,
enter the following namespace for the component:
xmlns:xyz="assets.components.mycontrols.*"
The property suffix
specified namespace. If the suffix is
a component in the namespace, as follows:
<xyz:myButton xmlns:xyz="assets.components.mycontrols.*" />
If the component file is located in the application root folder itself, the namespace is *
(asterisk), as follows:
... xmlns:xyz="*"
The namespace is also * (asterisk) if the component file is located in the /WEB-INF/flex/
user_classes subfolder in your application's root folder on the server. For example, if you place
the myButton.mxml component file in the /WEB-INF/flex/user_classes folder on the server,
enter the following tag to insert the component into an MXML file:
<xyz:myButton xmlns:xyz="*" />
Note: If two components have the same name and one is located in the application root folder and
the other is located in the WEB-INF folder, the component in the application root folder is used
first.
120
Chapter 5: Working with Components
tag.
prefix from the component tag if you don't specify it in the
mx
instead of
xmlns="..."
tells you what tag prefix to use to reference the components in the
:xyz
:xyz
If working with a standard Macromedia
<mx:Application>
xmlns:mx="..."
If you want to insert a custom MXML or
, then use the
tag prefix in your code to reference
xyz:
tags, as follows:
xmlns
). The following example is
Need help?
Do you have a question about the FLEX BUILDER-USING FLEX BUILDER and is the answer not in the manual?