ADOBE®FLEX®3BUILDING AND DEPLOYING ADOBE FLEX 3 APPLICATIONS
4CHAPTER 1Many types of design patterns have been catalogued and documented. For example, the Functional design pattern specifies that each module of
CHAPTER 594Using deferred creationBy default, containers create only the controls that initially appear to the user. Flex creates the container’s othe
95ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsSingle-view containersSingle-view containers by default create all their children when t
CHAPTER 596When you instantiate a navigator container, Flex creates all of the top-level children. For example, creating an Accordion container trigge
97ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsWhen the user navigates to another panel in the Accordion container, the navigator conta
CHAPTER 598Creating deferred componentsWhen you set a container’s creationPolicy property to none, components declared as MXML tags inside that contai
99ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications p = policy.selectedItem.toString(); } private function changeP
CHAPTER 5100Depending on the value of the creationPolicy property, Flex immediately begins instantiating controls inside the containers or it defers t
101ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDestroying componentsAfter you create a component, it continues to exist until the user
CHAPTER 5102In this example, the image on the left shows the application after the first container is populated with its children and data, but before
103ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications <mx:Button id="button2b" label="Button 2B"/> </
5ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsStruts is based on a Model-View-Controller (MVC) architecture, with a focus on the contro
CHAPTER 5104 <mx:Panel id="panel1" title="Panel 1 (index:2)" creationPolicy="queued" creationIndex="2&quo
105ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsaddToCreationQueue(id:Object, preferredIndex:int, callbackFunction:Function, parent:IFl
CHAPTER 5106 <mx:Form> <mx:FormItem label="first:"> <mx:HBox id="box1" creationPolicy="no
107ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications addToCreationQueue('redBox', 4); addToCreationQueue('blueBox', 2);
CHAPTER 5108The method argument is the function to call on the object. The args argument is an optional Array of arguments that you can pass to that f
109ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications <mx:DataGrid id="myGrid" width="350" height="200"
CHAPTER 5110 } ]]></mx:Script> <mx:Panel title="Ticker Sample" width="400" height="200">
111Chapter 6: Building OverviewTypical Adobe® Flex™ development environment include similar tools and asset types that you work with to create Flex ap
112CHAPTER 6• Web-tier compiler. The Flex module for Apache and IIS compiler provides web-tier compilation of MXML files on Apache and IIS web servers
113ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsLoggersYou can log messages at several different points in a Flex application’s life cy
CHAPTER 16Build phaseBuilding your application is an iterative process that includes three main tasks:1 Compile2 Debug3 TestAbout compilingCompiling y
CHAPTER 6114SWC filesA SWC file is an archive file for Flex components and other assets. SWC files contain a SWF file and a catalog.xml file. The SWF
115ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTo create an RSL SWC file, you add files to a library by using the include-classes and
CHAPTER 6116The alternative to embedding an asset is to load the asset at run time. You can load an asset from the local file system in which the SWF
117Part 2: Application DevelopmentTopicsBuilding Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
118PART 2
119Chapter 7: Flex SDK ConfigurationUse the configuration files included with Adobe® Flex® SDK to configure the compilers and other aspects of Flex.Fo
120CHAPTER 7The location of the license.properties file is operating system-dependent. It is located in the following directories:Edit the flex-config
121ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsConfiguration files layoutThe layout of the configuration files for Flex SDK is simple.
CHAPTER 7122You can also use a local configuration file that overrides the compiler options of the flex-config.xml file. You give this local configura
123ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTo set the initial heap size on the Sun HotSpot JVM, change the value of the Xms proper
7ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsWhen you compile your application, the Flex compiler creates a single SWF file from all o
CHAPTER 7124
125Chapter 8: Using the Flex CompilersAdobe® Flex® application and component compilers can be opened on the command line, in Adobe® Flex® Builder™, an
126CHAPTER 8The following example shows the input and output of the Flex compilers:You open the application compiler with the mxmlc command-line tool,
127ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsFlex Builder project compiler. The Flex Builder application compiler is opened by Fle
CHAPTER 8128By default, Flex Builder exposes the compilation options through the project properties. If you want to use a configuration file, you can
129ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe mxmlc command-line compiler does not generate an HTML wrapper. You must create your
CHAPTER 8130The compc command-line compiler. You open the compc compiler from the command line to create a SWC file. For more information, see “Using
131ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTo use the compc compiler, you should understand how to pass options and use configurat
CHAPTER 8132This displays a menu of choices for getting help. The most common choice is to list the basic configuration options:mxmlc -help listTo see
133ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUsing abbreviated option namesIn some cases, the command-line help shows an option with
CHAPTER 18About debugging an applicationFlex provides several tools that you use to debug your application, including the following:AIR Debug Launcher
CHAPTER 8134You pass all other options as you would when you open the command-line compilers. The following example sets the locale and source path wh
135ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsFor example, if your application’s top-level file is called MyApp.mxml, the compiler fi
CHAPTER 8136In some cases, options have multiple parent tags, as with the fonts options, such as compiler.fonts.managers and compiler.fonts.languages.
137ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications</compiler>However, the <manager-class> leaf node is unique, so you can set
CHAPTER 8138About option precedenceYou can set the same options in multiple places and the Flex compilers use the value from the source that has the h
139ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUsing mxmlc, the application compilerYou use the application compiler to compile SWF fi
CHAPTER 8140as3=true|falseUse the ActionScript 3.0 class-based object model for greater performance and better error reporting. In the class-based obj
141ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationsdefault-background-color intSets the application’s background color. You use the 0x not
CHAPTER 8142defaults-css-url stringDefines the location of the default style sheet. Setting this option overrides the implicit use of the defaults.css
143ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationses=true|falseInstructs the compiler to use the ECMAScript edition 3 prototype-based obj
9ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsWhat happens during a request to a SWF file When a customer requests the SWF file, the we
CHAPTER 8144fonts.languages.language-range lang range Specifies the range of Unicode settings for that language. For more informa-tion, see “Using Sty
145ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationsinclude-libraries library [...]Links all classes inside a SWC file to the resulting app
CHAPTER 8146keep-all-type-selectors=true|falseInstructs the compiler to keep a style sheet’s type selector in a SWF file, even if that type (the class
147ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationslibrary-path path-element [...]Links SWC files to the resulting application SWF file. T
CHAPTER 8148load-externs filename [...]Specifies the location of an XML file that contains <def>, <pre>, and <ext> symbols to omit f
149ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationsoptimize=true|falseEnables the ActionScript optimizer. This optimizer reduces file size
CHAPTER 8150runtime-shared-library-path=path-element,rsl-url[,policy-file-url,failover-url,...]Specifies the location of a runtime shared library (RSL
151ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationsshow-actionscript-warnings=true|falseShows warnings for ActionScript classes. The defau
CHAPTER 8152source-path path-element [...]Adds directories or files to the source path. The Flex compiler searches direc-tories in the source path for
153ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationstarget-player=player_versionSpecifies the version of Flash Player that you want to targ
CHAPTER 110Secure phaseSecurity is not necessarily a phase of the application development process, but is an issue that you should take into considera
CHAPTER 8154The following sections provide examples of using the mxmlc application compiler options on the command line. You can also use these techni
155ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsAdding metadata to SWF filesThe application compilers support adding metadata to SWF fi
CHAPTER 8156/rdf:li><rdf:li xml:lang='en-us'>it r0x0rs</rdf:li></rdf:Alt></dc:description><dc:publisher>Fra
157ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsFor more information about the HTML wrapper, see “Creating a Wrapper” on page 311.Using
CHAPTER 8158Incremental compilation can help reduce compile time on small applications, but you achieve the biggest gains on larger applications. The
159ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsCONFIG::debugging {// Execute debugging code here.}To pass constants, you use the compi
CHAPTER 8160The following example conditionalizes which class definition the compiler uses when compiling the application: // compilers/MyButton.aspac
161ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsPassing StringsWhen passing Strings, you must add extra quotes to ensure that the compi
CHAPTER 8162The component compiler can take most of the application compiler options, and the options described in this section. For a description of
163ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsOn the command line, you cannot point the compc utility to a single directory and have
11ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications• Does not allow web content to read any data from a server that is not from the same do
CHAPTER 8164The following sections describe common scenarios where you could use the compc command-line compiler. You can apply the techniques describ
165ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTo use components that are not in a package in a Flex application, you must declare a n
CHAPTER 8166Compiling components in packagesSome components are created inside packages or directory structures so that they can be logically grouped
167ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:mine="
CHAPTER 8168The namespace option matches a namespace (such as “http://www.adobe.com/2006/mxml”) with a manifest file. The include-namespaces option in
169ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationscompc -source-path . -output c:/jrun4/servers/flex2/flex/WEB-INF/flex/user_classes/MyB
CHAPTER 8170compc -source-path . -output c:/jrun4/servers/flex2/flex/WEB-INF/flex/user_classes/MyButtons.swc -namespace http://acme2006AcmeManifest.
171ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsClasses that you add with the include-sources option can be accessed from the generic n
CHAPTER 8172If you want to add many resources to the SWC file, consider using a configuration file rather than listing all the resources on the comman
173ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications• Usage of deprecated or removed ActionScript 2.0 APIs.• Situations where APIs behave d
CHAPTER 112The following example shows a typical deployment environment for a Flex SDK application: In this example, the customer requests the applica
CHAPTER 8174About SWC filesA SWC file is an archive file, sometimes also referred to as a class library, for Flex components and other assets. SWC fil
175ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDistributing SWC filesAfter you generate a SWC file, you can use it in your Flex applic
CHAPTER 8176For example:<?xml version="1.0"?><componentPackage><component id="MyButton" class="package1.MyButt
177ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThis utility is intended to improve the experience of users of the command-line compile
CHAPTER 8178The following example shows that fcsh dramatically reduces compilation time when compiling the same appli-cation multiple times: (fcsh) mx
179ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationsmxmlc arg1 [...]Compiles and optimizes the target Flex application or module using the
CHAPTER 8180
181Chapter 9: Using Flex Ant TasksThe Adobe® Flex® Ant tasks provide a convenient way to build your Flex projects using an industry-standard build man
182CHAPTER 9Using Flex Ant tasks You can use the Flex Ant tasks in your existing projects or create new Ant projects that use them. There are three ta
183ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications<source-path path-element="${FLEX_HOME}/frameworks"/></mxmlc><
13ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsBuild phaseTo build an application for Flex SDK, you define a directory structure on you
CHAPTER 9184Working with compiler options The compc and mxmlc compilers share a very similar set of options. As a result, the behavior of the mxmlc an
185ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsMultiple argument options Some compiler options, such as the default-size option, take
CHAPTER 9186The following example shows how to use the metadata nested element: <mxmlc ...><metadata description="foo app"><c
187ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe following options are implemented as implicit FileSets: compiler.external-library-p
CHAPTER 9188<?xml version="1.0" encoding="utf-8"?><!-- myMXMLCBuild.xml --><project name="My App Builder"
189ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUsing the compc task You use the compc Flex Ant task to compile component SWC files. Th
CHAPTER 9190Example The following example compc task builds a new SWC file that contains two custom components and other assets. The components are ad
191ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe html-wrapper task outputs the index.html and AC_OETags.js files for your Flex appli
CHAPTER 9192The following table describes the supported attributes of the html-wrapper task: Attribute Descriptionapplication The name of the SWF obje
193ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsRequired attributes The html-wrapper task requires the swf attribute. In addition, if y
© 2008 Adobe Systems Incorporated. All rights reserved.Building and Deploying Adobe Flex® 3 ApplicationsIf this guide is distributed with software tha
CHAPTER 114
CHAPTER 9194<taskdef resource="flexTasks.tasks" classpath="${basedir}/lib/flexTasks.jar"/><property name="FLEX_HOME&
195Chapter 10: Using Runtime Shared LibrariesAdobe® Flex® supports Runtime Shared Libraries (RSLs), which you can configure.TopicsIntroduction to RSLs
196CHAPTER 10You can create your own RSLs from custom libraries. You do this by using either the Adobe® Flex® Builder’s™ Build Project option for your
197ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsYou can also use the external-library-path, externs, or load-externs compiler options t
CHAPTER 10198With RSLs, the RSL needs to be downloaded once only. For two applications that use the same RSL, the result is an aggregate download size
199ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsRSL considerationsRSLs are not necessarily beneficial for all applications. You should
CHAPTER 10200The type of caching used by an RSL is based on the type of RSL. Standard or cross-domain RSLs are stored in the browser’s cache. If the u
201ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe options on the command line can also be represented by settings in the flex-config.
CHAPTER 10202On the command line, you typically specify that the output of compiling a library be an open directory rather than a SWC file by using th
203ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications• Compile your application against the library When you compile your Flex application,
15Chapter 2: Flex Application StructureOne of your first tasks when developing an Adobe® Flex™ application is to set up your development directory str
CHAPTER 10204About cross-domain RSLsCross-domain RSLs can be used by applications in any domain or sub-domain. The benefits of cross-domain RSLs are t
205ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsYou can also use digests for standard RSLs. This is useful if you update your RSLs freq
CHAPTER 10206About failoverThe failover feature is used for two reasons:• If the Flash Player is not at least version 9.0.115 and it tries to load a s
207ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications4 Select the Library Path tab:5 Click the Add SWC button. The Add SWC dialog box appear
CHAPTER 102087 Click OK to add the SWC file to your project’s library path. Flex Builder adds the new SWC file to the list of SWC files in the Library
209ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications10 For Verification, select Digests if you are using a cross-domain RSL or if you are u
CHAPTER 10210Compile with standard or cross-domain RSLs on the command lineTo use standard or cross-domain RSLs in your application on the command lin
211ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe following example shows how to use the runtime-shared-library-path option when comp
CHAPTER 10212If you are using a cross-domain RSL, you can also specify the location of the crossdomain.xml file, and the location of one or more RSLs
213ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsIf you use the optimizer tool, you must keep track of two separate library files: one f
16CHAPTER 2Flex Builder installation directory structureWhen you install Flex Builder, you install Flex SDK plus Flex Builder. The installer creates t
CHAPTER 10214Example of creating and using a standard and cross-domain RSLThis example walks you through the process of creating a library and then us
215ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThis links the library at compile time, which does not result in any benefits of extern
CHAPTER 10216Next, you create a crossdomain.xml file. If the domain that are you running the Flex application on is my-local-domain.com, then you can
217ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsIncluded framework RSLsThe framework RSLs are located in the flex_sdk_dir/frameworks/rs
CHAPTER 10218The following example shows the configuration file that loads a framework RSL:<runtime-shared-library-path><path-element>libs
219ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe following table shows the locations of the Player cache on various platforms:Using
CHAPTER 102204 Select the Library Path tab:5 Select Runtime Shared Library (RSL) from the Framework Linkage drop-down list. This instructs the appli-c
221ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsYou can view the settings of the SWC files that are included with Flex but whose classe
CHAPTER 10222Customize the deployment location of the framework RSLs1 Edit the framework.swc file’s settings in the Library Path Item Options dialog b
223ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsIn the Deployment Path/URL field, enter the location of the SWZ file. For example, “htt
17ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDevelopment directory structureAs part of the process of setting up the directory struct
CHAPTER 10224With the mxmlc command-line compiler, use the following command to compile the application:cd projectmxmlc -static-link-runtime-shared-li
225ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTroubleshooting RSLsRSLs can be complicated to create, use, and deploy. The following t
CHAPTER 10226#2148This error occurs when you try to open an application that uses RSLs in the standalone player or in the browser by using the file sy
227Chapter 11: LoggingYou can log messages at several different points in an Adobe® Flex® application’s life cycle. You can log messages when you comp
228CHAPTER 11The following example shows the types of logging you can do in the appropriate environment:To use client-side debugging utilities such as
229ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe debugger version of Flash Player lets you take advantage of the client-side logging
CHAPTER 11230On Microsoft Windows XP, the default location was \Documents and Settings\user_name. On Microsoft Windows 2000, the default location was
231ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsLog file locationThe default log file location changed between the initial Flash Player
CHAPTER 11232 } ]]></mx:Script> <mx:Label text="{reportVersion()}"/> <mx:Label text="{reportType()}&q
233ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications <mx:Script><![CDATA[ private function traceEvent(event:Event):void
CHAPTER 218The following example shows an example of the directory structure of a simple Flex application:This application consists of a root applicat
CHAPTER 11234The logging API consists of the following parts:Logger The logger provides an interface for sending a message to an active target. Logge
235ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe levels of logging messages are defined as constants of the LogEventLevel class. The
CHAPTER 112363 When you create a target within ActionScript, call the Log class’s addTarget() method to add the new target to the logging system. Call
237ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications useProxy="false" result="myData=ArrayCollection(srv.last
CHAPTER 11238 includeCategory="true" includeLevel="true" > <mx:filters> <mx:Array&
239ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationspackage { // The empty package. import mx.controls.Button; import flash.events.*;
CHAPTER 11240Within the application that uses the MyCustomLogger class, define a TraceTarget, as the following example shows:<?xml version="1.
241ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe previous example logs messages dispatched from any category because the TraceTarget
CHAPTER 11242 public class MyCustomLogger2 extends Button { private var myLogger:ILogger; public function MyCustomLogger2() {
243ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications } }}Compiler loggingFlex provides you with control over the output of warnin
19ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThere are no inherent restrictions in Flex for the location of the root directory of you
CHAPTER 11244
245Chapter 12: Using the Command-Line DebuggerIf you encounter errors in your applications, you can use the debugging tools to set and manage breakpoi
246CHAPTER 12This topic describes how to use the fdb command-line debugger. To use the Flex Builder debugger, see “Running and Debugging Applications”
247ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsCommand-line debugger limitationsThe command-line debugger supports debugging only at t
CHAPTER 122484 Select the “Internet Explorer should check to see whether it is the default browser” option, and click OK.The next time you start Inter
249ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsStarting a session with the stand-alone Flash PlayerYou can start a debugging session w
CHAPTER 12250You can also compile an application SWF file by using the web-tier compiler or the Flex Builder compiler. For more information on Flex co
251ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUsing the command-line debugger commandsThe fdb command-line debugger includes commands
CHAPTER 12252[trace] RadioButtonGroup.addInstance: instance = _level0._VBox0._Accordion0._Form2._FormItem3._RadioButton1 data = undefined label = 2005
253ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe following table summarizes the commands for manipulating breakpoints with the Actio
CHAPTER 220When you embed an asset, you compile it into your application’s SWF file. The advantage to embedding an asset is that it is included in the
CHAPTER 12254Breakpoint 1, myFunc() at file1.mxml:5 5ta1.text = "Clicked";(fdb)To see all breakpoints and their numbers, use the info breakp
255ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications(fdb) source mycommands.txt (fdb) source mydir\mycommands.txt (fdb) source c:\mydir\myc
CHAPTER 12256You can temporarily disable autodisplay expressions by using the disable display command. The disable display command has the following s
257ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTo set the list location to where the execution is currently stopped, use the home comm
CHAPTER 12258Viewing and changing the current fileThe list command acts on the current file by default. To change to a different file, use the cf comm
259ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsIf you use truncated file and function names, fdb tries to map the argument to an unamb
CHAPTER 12260For additional information about these options, use the help command, as the following example shows:(fdb) help info targetsHandling faul
261ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsGetting helpUse the help command to get information on particular topics. The help comm
CHAPTER 12262
263Chapter 13: Using ASDocASDoc is a command-line tool that you can use to create API language reference documentation as HTML pages from the classes
21ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe following example shows two Flex applications, appRoot1 and appRoot2. Each applicati
264CHAPTER 13In this example, the source code for the Button class is in the directory C:\flex\frameworks\source\mx\controls. The output is written to
265ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsPlacing ASDoc commentsPlace an ASDoc comment immediately before the declaration for a c
CHAPTER 13266The tag section begins with the first ASDoc tag in the comment, which is defined by the first @ character that begins a line, ignoring le
267ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsFor example, to exclude documentation on the click event in the MyButton subclass of th
CHAPTER 13268Because asterisks (*) are used to delimit comments, ASDoc does not support asterisks within a comment. To use an asterisk in an ASDoc com
269ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDocumenting ActionScript elementsYou can add ASDoc comments to class, property, method,
CHAPTER 13270*/public var myButtonLabel:String;A best practice for a property is to include the @default tag to specify the default value of the prope
271ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications* @private*/public function set html(value:Boolean):void {};The following rules define
CHAPTER 13272* @see someOtherMethod*/public function myMethod(param1:String, param2:Number):Boolean {}If the method takes an argument, include an @par
273ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDocumenting default propertiesThe [DefaultProperty] metadata tag defines the name of th
CHAPTER 222For shared MXML and ActionScript files that are outside of the application’s directory structure, you modify the source path to include the
CHAPTER 13274* </table>** @eventType buttonDown*/ public static const BUTTON_DOWN:String = "buttonDown"The ASDoc tool does several thi
275ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsASDoc tagsThe following table lists the ASDoc tags:ASDoc tag Description Example@copy
CHAPTER 13276@example exampleTextApplies style properties, generates a heading, and puts the code example in the correct loca-tion. Enclose the code i
277ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUsing the @see tagThe @see tag lets you create cross-references to elements within a cl
CHAPTER 13278• PackageName ASDoc looks in a different package for the link destination.• global ASDoc looks in the Top Level package for the link de
279ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsSummary of commonly used HTML elementsThe following table lists commonly used HTML tags
CHAPTER 13280Running the ASDoc tool You use the following options to specify the list of classes processed by the asdoc command: doc-classes, doc-sour
281ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsIn this example, the classes must be located at comps\GraphingWidget.as and comps\Graph
CHAPTER 13282If you set the exclude-dependencies option to true, dependent classes found when compiling classes are not documented. The default value
283ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe asdoc command also recognizes the following options from the compc component compil
23ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsYou can also create SWC files that you package and reuse among multiple applications. Yo
CHAPTER 13284For more information, see “Using mxmlc, the application compiler” on page 139. All other application compiler options are accepted but ig
285Chapter 14: VersioningYou might encounter some versioning issues when working on Adobe® Flex® applications. When compiling, you can choose the vers
286CHAPTER 14Using multiple SDKsFlex Builder lets you change the version of the SDK that you use to compile your projects. You can select the SDK when
287ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsWhen you set the compatibility-version option, you must be sure that the configuration
CHAPTER 14288 compiler option set to 2.0.1 and once without setting it. --><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml&quo
289ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsMenu control’s horizontalGap propertyThe default value of the horizontalGap prop-erty f
CHAPTER 14290Border style for Panel containersYou can set the borderStyle property to "solid" and set a borderColor and borderThickness prop
291ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDateChooser subcomponent stylesThe cornerRadius and fillColors styles are applied to th
CHAPTER 14292PopUpManager subcompo-nent stylesPopUp controls inherit their styles from the Application if they were not explicitly set on the PopUp co
293ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe configuration file syntax is also different between SDK 2.0.1 and SDK 3. If you use
iiiContentsPart 1: Application DesignChapter 1: Application Development PhasesDesign phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 224Modules let you split your application into several separate SWF files. The main application, or shell, can dynam-ically load other SWF fil
CHAPTER 14294<fonts> <managers> <manager-class> flash.fonts.JREFontManager </manager-class> <manager-class
295ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTargeting Flash Player versionsYou can use the target-player compiler option to specify
CHAPTER 14296
297Part 3: Application Deployment TopicsDeploying Flex Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
298PART 3
299Chapter 15: Deploying Flex ApplicationsWhen you deploy an Adobe® Flex® application, you make the application accessible to your users. The process
300CHAPTER 15Deployment optionsThe following example shows a typical deployment environment for a Flex application: Deploying an application for Flex
301ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications• Write a wrapper for the SWF file if you access it from an HTML, JSP, ASP, or another
CHAPTER 15302Accessing data services from a deployed applicationIn a typical Flex development environment, you build and test your application behind
303ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsIn general, all compiled SWF files that are stored in the project’s /bin-debug director
25ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe mxmlc compiler has many options that you can specify on the command line, or that yo
CHAPTER 15304Deployment checklistThe deployment checklist contains some common system configuration issues that customers have found when deploying Fl
305ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsHistory management and deep linking To support history management and deep linking, you
CHAPTER 15306Security files If you use container-based security, then be sure to update your security constraints to include your Flex application. In
307ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTypes of network accessDeployed Flex applications typically make several types of reque
CHAPTER 153084 Direct access of a web service. In the preceding example, the client directly accesses a service on finance.example.com. If a deployed
309ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsStep 2. Verify access from server to server within your firewallIn some cases, an exter
CHAPTER 15310Step 4. Configure the proxy serverIn “Step 3. Verify access to your servers from outside the firewall” on page 309, you ensure that you c
311Chapter 16: Creating a WrapperAdobe® Flex™ applications can take the form of a SWF file that you embed in an HTML page by using the <object>
312CHAPTER 16Adobe® Flex® Builder™and the Flex module for Apache and IIS generate a wrapper that embeds your Flex appli-cation. The Flex Builder wrapp
313ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsYou typically use the index.template.html file found in each of these directories as th
CHAPTER 226Compiling a Flex Builder applicationWhen you compile a project with Flex Builder, you open the Flex compilers from within Flex Builder itse
CHAPTER 16314For more information about Express Install, see “Adding Express Install to your wrapper” on page 320. For more information about deep lin
315ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsCreating a simple wrapperYou can write your own wrapper for your SWF files rather than
CHAPTER 16316The following example illustrates the minimum number of requests that the client browser makes when JavaScript is enabled:The following e
317ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationsdocument.write("<embed name='MyApp' src='MyApp.swf' plugins
CHAPTER 16318<noscript> block The code in the <noscript> block uses <object> and <embed> tags to embed the SWF file in the HT
319ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsAdding features to the wrapperThe default wrapper that Flex Builder creates includes de
CHAPTER 16320• Do not put the contents of the JavaScript file directly in the HTML page. This causes Internet Explorer to prompt the user before enabl
321ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications• playerProductInstall.swf• YourApp.swfThe AC_OETags.js file defines functions that the
CHAPTER 16322The <object> and <embed> tags support a set of properties that add additional functionality to the wrapper. These properties
323ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe following example shows a simple <embed> tag with the optional quality attrib
27ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsHowever, if your application accesses assets at run time, the application requests asset
CHAPTER 16324The following table describes the supported <object> and <embed> tag properties: Property Type DescriptionalignString Specifi
325ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsallowScriptAccessString Controls the ability to perform outbound scripting from within
CHAPTER 16326bgcolorString Specifies the background color of the application. Use this property to override the background color setting specified in
327ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationscodetypeString Defines the content type of data expected when downloading the applicati
CHAPTER 16328hspaceint Specifies the amount of white space inserted to the left and right of the SWF file. The default value is typically not specifie
329ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsqualityString Defines the quality of playback in Flash Player. Valid values of quality
CHAPTER 16330styleString Specifies style information for the SWF file.The syntax of the value of the style property is determined by the default style
331ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe <object> and <embed> tags can also take additional properties that are
CHAPTER 16332Requesting an MXML file without the wrapperIf you are using the web-tier compiler, also known as the Flex module for Apache and IIS, you
333Chapter 17: Using Express InstallAfter developing an application, you want to ensure that all users can run it and that they have a current version
CHAPTER 228
334CHAPTER 17Editing your wrapper for Express InstallAfter you compile your application into a SWF file, you write a wrapper that embeds that SWF file
335ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsAdd Express Install support to your wrapper1 Open your wrapper in a text editor.2 Add o
CHAPTER 17336"bgcolor", "#869ca7","name", "MyFirstProject", "allowScriptAccess","sameDomain&quo
337ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUnderstanding the Express Install scriptThe scripts that implement Express Install in y
CHAPTER 17338Alternatives to Express InstallWhen you add the Express Install script to your wrapper, one of the following results occur when a client
339ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsFlash Player is available from the Firefox Plug-in Finder Service. This means that if t
CHAPTER 17340
341Chapter 18: Using the Flex Module for Apache and IISTopicsIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
342CHAPTER 184 The compiler module returns an HTML file to the web server, which returns it to the client.5 If the SWF file was compiled successfully,
343ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsVersions and requirementsThe compiler module comes in the following versions: • Flex 3
29Chapter 3: Applying Flex SecurityDevelopers (including programmers and other authors) who design and publish Flex applications can control the secur
CHAPTER 18344The installer modifies your web server’s configuration. On Apache, the installer adds the following to the end of your httpd.conf file: L
345ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUse the web-tier compiler1 (Windows) Reboot your computer. 2 Start or restart the web s
CHAPTER 18346You can add a comment to this file by using the pound (#) sign at the beginning of the line that you want to comment out.If you make chan
347ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsExample compiler.conf fileThe following is an example of a compiler.conf file:flex_conf
CHAPTER 18348# increase number of lines to 10:lines_in_context=10Customizing the templateWhen the web-tier compiler compiles an MXML file into a SWF f
349ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsIn addition, the template does not convert query string parameters to flashVars variabl
CHAPTER 18350Debugging with the web-tier compilerThe web-tier compiler has the following debugging-related features:• Detects a query string parameter
351ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsCustomizing error outputYou can select the number of lines of code to show in the brows
CHAPTER 18352
30CHAPTER 3Flex supports working with the web application security of any J2EE application server. In addition, precompiled Flex applications can inte
31ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDeclarative security is recommended over programmatic security for most applications bec
CHAPTER 332The only type of persistent storage is through the SharedObject class, which is embodied as a file in a directory whose name is related to
33ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsAbout sandboxesThe sandbox type indicates the type of security zone in which the SWF fil
CONTENTSivUsing deferred creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 334The following table shows how the sandbox type is determined:Browser securityFlash Player clients can be one of the following four types:•
35ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsSWF file loading and cross-scripting are always permitted between SWF files that reside
CHAPTER 336The navigateToURL() methodThe navigateToURL() method opens or replaces a window in the Flash Player’s container application. You typically
37ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsYou can also assign a SWF file to be in the local-trusted sandbox when you load it from
CHAPTER 338Deploy checklistBefore you deploy your application, ensure that your proxy servers, firewalls, and assets are configured properly. Adobe pr
39ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsLoading assetsThe most common task that developers perform that requires an understandin
CHAPTER 340• Loading SWF file’s sandbox. To load an asset from a network address, you must ensure that your SWF file is in either the remote or local-
41ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsLoading local assetsIn some cases, your SWF file might load assets that reside on the cl
CHAPTER 342Authentication requires a website to store information about users. This information includes the role or roles assigned to each user. In a
43ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications<auth-constraint> <role-name>manager</role-name> </auth-constraint&
vCreating libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 344</table> <input type=submit> </form> The results are submitted to the container’s JAAS system with base-64 encoding, whic
45ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUsing secured servicesSecured services are services that are protected by resource const
CHAPTER 346Flash Player also provides support for versions of RTMP that are tunneled through HTTP and HTTPS. RTMP refers to RTMP transmitted within an
47ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsFor more information about using the LocalConnection class, see Programming ActionScript
CHAPTER 348By default, a SWF file served over an unsecure protocol, such as HTTP, cannot access other documents served over the secure HTTPS protocol,
49ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDisabling viewSourceURLIf you enabled the view source feature by setting the value of th
CHAPTER 350Input validationInput validation means ensuring that input is what it says it is or is what it is supposed to be. If your application is ex
51ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsHandling errorsThe SecurityError exception is thrown when some type of security violatio
CHAPTER 352 } ]]></mx:Script> <mx:Button id="b1" label="Click Me To Trigger Security Error" click="t
53ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsTo ensure that passwords are transmitted from the client to the server safely, enforce t
CONTENTSviChapter 16: Creating a WrapperAbout the wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 354About the mm.cfg fileYou configure the debugger version of Flash Player by using the settings in the mm.cfg text file. You must create this
55ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsAbout FlashPlayerTrust filesFlash Player provides a way for administrative users to regi
CHAPTER 356Access the Settings Manager for your Flash Player1 Open an application in Flash Player. 2 Right-click and select Settings. The Adobe Flash
57Chapter 4: Optimizing Flex ApplicationsAfter you have a working application, you can explore ways to make that application download faster and perfo
58CHAPTER 4• Do not attempt to test a large application’s performance all at once. Rather, test small pieces of the application so that you can focus
59ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications<?xml version="1.0"?><!-- optimize/ShowInitializationTime.mxml -->
CHAPTER 460 public var sTime:Number; public var eTime:Number; public var pTime:Number; private function init():void {
61ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsCalculating memory usageYou use the totalMemory property in the System class to find out
CHAPTER 462 </mx:FormItem> <mx:FormItem label="totalMemory:"> <mx:Label text="{totmem} bytes&qu
63ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications4 Select High System Performance from the Power Schemes drop-down box.5 Click OK.Changin
1Part 1: Application DesignTopicsApplication Development Phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 464// Set expiration date to a date in the past.response.setDateHeader("Expires", 946080000000L); //Approx Jan 1, 2000// Force alway
65ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applicationsimport flash.printing.* // Error. This class is not used.import mx.controls.Button; // E
CHAPTER 466The following table describes the tags used in this file:You can examine the list of prerequisites and dependencies for your application de
67ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications<?xml version="1.0"?><!-- optimize/UnusedClasses.mxml --><mx:Ap
CHAPTER 468• Using run-time stylesheets• Using Runtime Shared Libraries (RSLs)• Loading assets at run time rather than embedding themThis section desc
69ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsUsing character ranges for embedded fontsBy specifying a range of symbols that compose t
CHAPTER 470Rather than loading SWF files into the main application with the SWFLoader control, consider having the SWF files communicate with each oth
71ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsIf you have multiple applications but those applications share a core set of components
CHAPTER 472To use ordered creation, you set the creationPolicy property of a container to queued, as the following example shows:<?xml version=&quo
73ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications } ]]></mx:Script> <mx:Panel title="VBox with Repeater&quo
CHAPTER 474 <mx:Button id="b2" label="Jack"/> <mx:Button id="b3" label="Sawyer"
75ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications </mx:Panel> <mx:Button id="myButton" click="destroyBu
CHAPTER 476The weakRef parameter to the addEventListener() method provides you with some control over memory resources for listeners. A strong referen
77ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsSome applications must call the setStyle() method during the application or object insta
CHAPTER 478 StyleManager.getStyleDeclaration("Button").setStyle("color", 0x00CCFF); } ]]></mx:Script>
79ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications ]]></mx:Script> <mx:Button id="myButton" label="Click Me
CHAPTER 480When you nest containers, each container instance runs measuring and sizing algorithms on its children (some of which are containers themse
81ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsImproving effect performanceEffects let you add animation and motion to your application
CHAPTER 482Suspending background processingTo improve the performance of effects, you can disable background processing in your application for the du
83ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe low setting favors playback speed over appearance and never uses anti-aliasing. The
3Chapter 1: Application Development PhasesIt is difficult to define the exact process that all Adobe® Flex™ developers use to build and deploy applica
CHAPTER 484Enable bitmap caching only when you need it, such as during the duration of an animation, and only on a few objects at a time because it ca
85ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsDisabling live scrollingUsing a DataGrid control with large data sets might make it slow
CHAPTER 486<!-- optimize/VBoxRepeater.mxml --><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script><
87ADOBE FLEX 3Building and Deploying Adobe Flex 3 Applications <mx:List id="birdlist" rowHeight="150" width="250&qu
CHAPTER 488Improving charting component performanceYou can use various techniques to improve the performance of charting controls. Avoiding filtering
89ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsSpecifying gutter stylesSpecify gutter styles when possible. The gutter area of a Cartes
CHAPTER 490 </mx:Panel></mx:Application>
91Chapter 5: Improving Startup PerformanceAdobe® Flex® helps you improve the actual and perceived startup times of your Flex applications. You can do
92CHAPTER 5The remaining sections of this topic describe how to use deferred creation to reduce overall application startup time and ordered creation
93ADOBE FLEX 3Building and Deploying Adobe Flex 3 ApplicationsThe following example shows the major events that are dispatched during a container’s cr
Comments to this Manuals