![MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Скачать руководство пользователя страница 27](http://html1.mh-extra.com/html/macromedia/flex-developing-components-and-themes/flex-developing-components-and-themes_manual_3388115027.webp)
Creating simple components
27
13.
Right-click the symbol in the Flash Library and select Export SWC File.
14.
Save the new SWC file as orangecircle.swc.
15.
In a text editor, create an MXML file that contains the following code:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:myp="myPackage.*" >
<myp:orangecircle />
</mx:Application>
You must add a namespace declaration that includes the package whenever you access a
component that uses ActionScript files in packages.
You cannot name the file orangecircle.mxml. You must give it a name that is different from the
component’s name, such as oc.mxml.
16.
Save the MXML file.
17.
Copy the SWC file that you created (orangecircle.swc) to the same directory as the MXML file.
This should not be the same directory in which you saved the ActionScript and FLA file. This
directory must be in the web application’s directory structure, so that Flex can compile a SWF
from the MXML file.
18.
Request the MXML file in your browser or a stand-alone Flash Player. An orange circle should
appear.
Creating the Blue Button
This procedure shows you how to extend an existing Flex control. In this example, it is a button.
The button’s border and text are blue. When you insert the Blue Button component into your
Flex application, it inherits all of the events, behaviors, and capabilities of a standard Button
control, but it has a customized style.
To create the Blue Button:
1.
Set up the Flash environment by adding the Flex components and class files. For more
information, see
“Adding Flex classes and components to the Flash IDE” on page 8
.
2.
In Flash, create a FLA file.
3.
Edit the FLA file’s local classpath settings to include the following two classpath entries:
■
$(LocalData)/Flex Classes
■
. (the dot)
For more information, see
“Changing the Flash classpath” on page 10
.
4.
Select Insert > New Symbol.
The Create New Symbol dialog box appears.
Rather than convert existing graphical assets to a symbol, you create a symbol and add
dependent components to it as assets.
Содержание FLEX - DEVELOPING COMPONENTS AND THEMES
Страница 1: ...Developing Flex Components and Themes in Flash Authoring ...
Страница 4: ...4 Contents ...
Страница 44: ...44 Chapter 2 Creating Basic Components in Flash MX 2004 ...
Страница 82: ...82 Index ...