Inserting controls and containers in an MXML file
119
Manually inserting components
If you prefer to insert components by hand in Code view, make sure you specify the component
namespace.
To manually insert a component:
1.
Open the parent MXML file in Code view (View > Code) and enter the component tag.
For standard Flex components, you can use code hints to work faster. You can also get code
hints for custom components if you package them locally or synchronize them from the server.
For more information, see
“Including the component’s properties in code hints” on page 124
and
“Synchronizing with custom components on the server” on page 125
.
For custom components, the tag name and case must be identical to the name and case of the
component’s MXML file (see
“Creating MXML component files” on page 121
). For example,
if the component’s MXML file is called LoginForm.mxml, then the component tag’s name and
case is
<LoginForm...>
. If you enter
<loginForm...>
, the compiler will generate an error.
The following is an example of a custom component tag:
<xyz:LoginForm/>
where
xyz
is the tag prefix used to reference components in a specified namespace (for more
information, see the next step).
2.
Specify the namespace of the component.
Namespaces describe the location of component files on the Flex server. You must specify the
namespace so that your application knows where to look for the file. For more information, see
“Specifying component namespaces in your code” on page 119
.
Flex Builder will automatically specify the namespace if you package the component locally or
synchronize it from the server.
3.
Save the file.
Specifying component namespaces in your code
If you insert a component in an MXML file manually, you need to specify the component’s
namespace. Namespaces describe the location of component files on the Flex server so that your
application knows where to look for the files.
You specify the namespace with the
xmlns
(for “XML namespace”) property of either the
<mx:Application>
tag or the custom component tag.
Summary of Contents for FLEX BUILDER-USING FLEX BUILDER
Page 1: ...Using Flex Builder...
Page 116: ...116 Chapter 4 Building a Flex User Interface Visually...
Page 144: ...144 Chapter 6 Working with Data...
Page 154: ...154 Appendix A Basic Flex Concepts...