MACROMEDIA FLEX BUILDER-USING FLEX BUILDER Use Manual page 124

Table of Contents

Advertisement

Creating a component from an existing component
You can create a new component from any component in an existing MXML file. Flex Builder
creates the new component file based on the component you select.
To create a component file from a component in an existing MXML file:
In Flex Builder, open an MXML file containing the component you want to use.
1.
Do one of the following:
2.
If working in Design view, select and right-click the standard component you want as the
basis of your new custom component and then select Create Local Component from the
context menu.
If working in Code view, select the code for a component you want as the basis of your new
custom component, right-click the selected code, and then select Create Local Component
from the context menu.
The Save Component File dialog box appears.
Name and save the component file.
3.
Insert your new component by selecting Insert > Local Component and selecting the
4.
component file.
Flex Builder will not replace the code you selected in Step 2. If you want, delete the code after
inserting the new component.
If the Flex server is running on a remote computer, copy the component file to the application
5.
folder on the server.
Make sure the application folder structure on the server matches the folder structure on your
local computer, and that you copy the file to the same folder on the server. If you specified a
remote folder when you defined your site in Flex Builder, you can use the Put command (Site
> Put) to upload the file to the server. The Put command recreates the local folder structure on
the server if it doesn't exist.
If you move the component file to another folder on the server, such as the /WEB-INF/flex/
user_classes folder, then the namespace Flex Builder wrote in your MXML file might not be
valid anymore. Modify the namespace as necessary by modifying the
component tag. For more information, see
on page
119.
Including the component's properties in code hints
Code hints in Flex Builder let you write MXML or ActionScript more rapidly. You can enhance
this feature by including the properties of your custom components in the code hints.
For MXML component files, Flex Builder will include properties declared using MXML syntax.
For ActionScript component files, Flex Builder will include only properties that are declared with
an Inspectable statement. The Inspectable statement must immediately precede the property's
variable declaration. The syntax for the Inspectable statement is as follows:
[Inspectable(attribute=value[,attribute=value,...])]
property_declaration name:type;
124
Chapter 5: Working with Components
"Specifying component namespaces in your code"
property of the
xmlns

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex builder

Table of Contents