Specifications
311
Chapter 16: Creating a Wrapper
Adobe® Flex™ applications can take the form of a SWF file that you embed in an HTML page by using the
<object> and <embed> tags. The HTML page can also reference an external JavaScript file to embed the Flex
application. Collectively, the HTML page and JavaScript file are known as the wrapper.
Topics
About the wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Creating a simple wrapper. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315
Adding features to the wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .319
About the object and embed tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .321
Requesting an MXML file without the wrapper. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .332
About the wrapper
The wrapper is responsible for embedding the Flex application’s SWF file in a web page, such as an HTML, ASP,
JSP, or Adobe ColdFusion page. In addition, you use the logic in the wrapper to enable deep linking and Express
Install, and to ensure that users both with and without JavaScript enabled in their browsers can access your Flex
applications. You can also use the wrapper to pass
flashVars variables into your Flex applications and to use the
ExternalInterface API. These topics are described in “Communicating with the Wrapper” on page 1035 in Adobe
Flex 3 Developer Guide.
There are several ways to create a wrapper:
• Write a custom wrapper using the instructions in “Creating a simple wrapper” on page 315.
• Export and customize an HTML wrapper from Flex Builder. For more information, see “About the Flex
Builder wrapper” on page 312.
• Use the templates provided in the /templates directory. For more information, see “Ab o u t t h e H T M L
templates” on page 312.
• Use the html-wrapper Flex Ant task. For more information, see “Using the html-wrapper task” on page 190.
• Generate the HTML wrapper with the Flex module for Apache and IIS. For more information, see “Custom-
izing the template” on page 348.










