20
Chapter 1: Working with Flash MX 2004
Note:
You should not store custom SWC files in the /WEB-INF/flex/frameworks directory.
SWC files must be at the top level of the directory. You cannot put them in subdirectories, unless
you explicitly define those subdirectories with the
<lib-path>
setting. The package information
for the classes in the SWC file is internalized by the SWC file, so you are not required to mirror
that package when referring to the SWC file.
You can also store your SWC file in the
flex_app_root
/WEB-INF/flex/user_classes directories.
If you export a new version of a SWC file from Flash to Flex, you do not have to restart Flex or
close your browser. The Flex application recognizes that the SWC file was added or changed
based on its timestamp, and reloads it in the client when the application refreshes the page.
To determine if a SWC is reloading properly, you can add the following arguments to the Flex
J2EE server Java arguments. If you are using JRun, add these entries to the jvm.config file located
in the
flex_root
/jrun4/bin directory.
-Dtrace.cache -Dtrace.swc
After restarting the Flex server, you see notifications from FileWatcherService as you modify your
SWC file and then reload the MXML. The logging information indicates where the SWC file
that Flex is loading is located on the Flex server’s hard disk.
You can also verify that Flex is not loading older versions of SWC files from an unexpected
location by setting the
<create-compile-report>
option to
true
in the flex-config.xml file, as
the following example shows:
<debugging>
<create-compile-report>true</create-compile-report>
...
</debugging>
Flex generates a file named
your_app
-report.xml in the same directory as your MXML file. This
file contains the source location and timestamp of every symbol definition that went into the final
SWF file.
Instantiating components in Flex
To use your component in your Flex applications, at a minimum you must declare a namespace
and use a tag that matches the name of the component, as the following example shows:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:my="*"
>
<my:ModalText />
</mx:Application>
If you store the component in the same directory as the application, you can specify a global
namespace and forego the tag prefix, as the following example shows:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*"
>
<ModalText />
</mx:Application>
Содержание 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 ...