Deployment options

The following example shows a typical deployment environment for an application:

Deploying an application for Flex SDK and Adobe® Flex® Builder® ­ might require you to perform some or all of the following actions:

  • Copy the application SWF file to your deployment server. As the previous example shows, you copy the application to webserver.example.com.

  • Copy any asset files, such as icons, media files, or other assets, to your deployment server.

  • Copy any custom RSLs to your web server or application server. For more information, see Deploying RSLs with Flex SDK.

  • Copy the framework RSLs to your deployment server. For more information, see Using the framework RSLs.

  • Copy any SWF files for your module to your deployment server in the same directory structure as you used for your development environment. Deploying modules with Flex SDK.

  • Copy any SWF files required to support Flex features, such as deep linking or runtime CSS. For more information, see Deploying additional Flex files.

  • Write a wrapper for the SWF file if you access it from an HTML, JSP, ASP, or another type of page.

    A deployed SWF file can encompass your entire web application, however it is often used as a part of the application. Therefore, users do not typically request the SWF file directly, but request a web page that references the SWF file. Flash Builder can generate the wrapper for you, or, you can write the wrapper. For more information, see Creating a wrapper.

  • Create a crossdomain.xml file on the server for data service, if you directly access any data services outside of the domain that serves the SWF file. For more information, see Accessing data services from a deployed application

Deploying RSLs with Flex SDK

When your application uses custom RSLs, you must make sure to deploy the RSL on your deployment server, in the same domain, unless you are using cross-domain RSLs. You use the runtime-shared-libraries option of the Flex compiler to specify the directory location of the RSL at compile time. Ensure that you copy the RSL to the same directory that you specified with runtime-shared-libraries.

By default, the Flex compilers dynamically link your application against the framework RSLs. This means that classes in the SDK are externally loaded at run time from the framework RSLs. The default location of these RSLs is on the Adobe web site. If you clients do not have network connectivity, you must deploy the framework RSLs to a local location, or disable framework RSLs. To customize the location of framework RSLs, edit the flex-config.xml file or edit their location in the Flash Builder Flex Build Path dialog box. To disable framework RSLs, set the static-link-runtime-shared-libraries compiler option to true.

Flex also provides framework RSLs. These libraries are comprised of the Flex class libraries and can be used with any application built with Flex. The framework RSLs are precompiled libraries of framework classes and components. 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 more information, see Runtime Shared Libraries.

Deploying modules with Flex SDK

Modules are SWF files that can be loaded and unloaded by an application. They cannot be run independently of an application, but any number of applications can share the modules. When your application uses a module, you must make sure to deploy the module’s SWF file on your deployment server in the same directory structure as you used for your development environment. For more information, see Modular applications.

Deploying additional Flex files

The implementation of some Flex features requires that you deploy additional files along with your application’s SWF file. For example, if you use deep linking functionality in your application, you must deploy the historyFrame.html, history.css, and history.js files. If you use the Express Install version detection feature, you also must deploy the playerProductInstall.swf file with your SWF file. You typically deploy these files in the same location that the default HTML wrapper looks for them. For example, the deep linking files are typically in a sub directory called /history.

For a complete list of additional Flex files that you might deploy with your application, see Deployment checklist.

Accessing data services from a deployed application

In a typical Flex development environment, you build and test your application behind a corporate firewall, where security restrictions are much less strict than when a customer runs the application on their own computer. However, when you deploy the application, it runs on a customers computer outside your firewall. That simple change of location might cause the application to fail if you do not correctly configure your data services to allow external access.

Most run-time accesses to application resources fall into one of the following categories:

  • Direct access to asset files on a web server, such as image files.

  • Direct access to resources on your J2EE application server.

  • Data services requests through a proxy. A proxy redirects that request to the server that handles the data service request.

  • Direct access to a data service.

As part of deploying your application, ensure that all run-time data access requests work correctly from the application that is executing outside of your firewall.