Application assets

When deploying a Flex application, you must make sure you also deploy all the assets that the application uses at run time. These include files that are used by the wrapper to support features such as deep linking and Express Install, as well as files that are loaded by the application such as resource bundles or RSLs.

In the case of wrapper code, you will probably be cutting and pasting it from the HTML templates included with the SDK into your JSP or ASP or PHP pages.

Check that the following assets are deployed with your application if you use those assets in your Flex applications:

Feature

Assets to Deploy

Wrapper files

If you use a wrapper, be sure to include it in the deployment process. The wrapper can be any file that returns HTML, such as PHP, ASP, JSP, or ColdFusion. Typically, this file uses the SWFObject 2 logic, or includes an <object> or <embed> tag to embed the Flex application.

In addition, if you use dynamic pages to query databases or perform other server-side actions for your Flex application, be sure to deploy those as well. This is especially important if you use the data wizard in Flash Builder to generate these pages.

For more information, see Creating a wrapper.

Version detection

To support version detection or Express Install in your HTML wrapper, you must add the code based on the Flex wrapper template to your wrapper, as well as deploy the swfobject.js file. You must also deploy the playerProductInstall.swf file.

For more information, see Creating a wrapper.

Deep linking

To support deep linking, you must include the following files in your deployment:

  • history.js

  • history.css

  • historyFrame.html

You must import the first two files into your HTML wrapper, and store all of these files in a /history subdirectory.

For more information, see Deep linking.

Runtime shared libraries (RSLs)

For standard RSLs, deploy the RSL SWF files with your Flex application. You must be sure to deploy the SWF files to the same relative location that the compiler used. If you are deploying an a custom RSL, be sure to optimize the RSL’s SWF file prior to deployment.

For framework RSLs, if your client does not have internet connectivity, be sure to deploy both the signed (*.SWZ) and unsigned (*.SWF) RSLs. Flash Player will first try to load the signed RSLs from the Adobe web site, so you should not have to deploy them in most cases.

For framework and cross-domain RSLs, be sure to deploy failover RSLs to the locations you specified when you compiled the application.

For more information, see Runtime Shared Libraries.

Runtime stylesheets

If you use runtime stylesheets in your application, you must deploy the SWF files so that they can be loaded. You can load run-time stylesheet SWF files either locally or remotely. However, if you load them locally, the stylesheets must be in the same relative location that you specified in the application.

For more information, see Loading style sheets at run time.

Modules

If your application uses modules, you must deploy the module SWF files so that they can be loaded.

Modules are SWF files that can be loaded and used by any number of applications. If multiple applications use your modules, then you should deploy them to a location that all applications can load them from rather than deploy them multiple times across different domains.

For more information, see Modular applications.

Runtime localization

If your application uses run-time localization (if it, for example, lets the user switch from English to Japanese language at run time), then you might need to deploy resource module SWF files. These modules can contain one or more resources bundles for one or more locales.

For more information, see Localization.

Security files

If you use container-based security, then be sure to update your security constraints to include your Flex application.

In addition, if you load assets from multiple domains, be sure to deploy any crossdomain.xml files that are required by your applications.

Miscellaneous runtime assets

Not all assets are embedded at compile time. For example, FLV and image files are usually loaded at run time to keep the SWF file as small as possible. Be sure to check that you deploy the following types of assets that are typically loaded at run time with your Flex application:

  • FLV files

  • SWF files

  • Sound files (such as MP3 files)

  • Images (such as GIF, JPG, and PNG files)

Data files

It is not uncommon for flat data files to be used as a data provider in Flex applications. Be sure to deploy any text files, which might appear in various formats such as XML, that are loaded at run time.

View source

If you use the view source functionality in Flash Builder, be sure to include the supporting files when you deploy your application. These files include the selected source code files, the source viewer’s SWF file, HTML and CSS files for the source viewe, an XML file, and a ZIP file of the source code that users can download. You must maintain the directory structure that Flash Builder generates in the output directory.

To enable view source and generate the ZIP file in Flash Builder, select Project > Export Release Build. Then select the Enable View Source option.

For more information, see Publishing source code.