Adobe Flex 3 Help

Adding the Express Install script to the wrapper

After you write your own wrapper, follow these steps to add support for Express Install. These steps require the following files, which are located in the /templates/express-installation directory:

  • index.template.html Wrapper file that detects the Flash Player version and initiates Express Install if necessary. You can integrate this code with your website.

  • AC_OETags.js Script file that provides methods for Flash Player version detection and embedding your Flex application. You call methods in this file from your wrapper.

  • playerProductInstall.swf Application that initiates Express Install. You deploy this file with your application.

Add Express Install support to your wrapper

  1. Open your wrapper in a text editor.
  2. Add or include the script in the index.template.html file to your wrapper. This file is included in the /templates/express-installation directory. For a detailed description of this script, see Understanding the Express Install script.
  3. In the Globals section of the script, set the minimum version of Flash Player that your users must be running. For example:
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    
    

    If you are using Flex Builder to generate the wrapper, you can set this value in the Detect Flash Version text box in the Compiler Properties dialog box.

    This is useful, too, to ensure that your users have a version of Flash Player that supports certain features. For example, if you want your users' Flash Player to support signed framework RSLs, set the minimum version to 9.0.115.

  4. Deploy the AC_OETags.js file to a location that is accessible to your wrapper. This file is included in the /templates/express-installation directory. This file is also generated by Flex Builder. The default location is the same directory as the wrapper. If you change it, you must also edit the following line in the wrapper:
    <script src="AC_OETags.js" language="javascript"></script>
    
    
  5. Edit the calls to the AC_FL_RunContent() method. This method passes information about the SWF file to be run to the AC_OETags.js external script file. The functions defined in the AC_OETags.js file write the <object> and <embed> tags for the SWF file.

    There are multiple calls to this method in script blocks that meet different conditions. In the first script block, change the id and name parameters to match your SWF file's name:

    if (hasProductInstall && !hasRequestedVersion) {
            AC_FL_RunContent(
            "src", "playerProductInstall",
            "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+
                MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
            "width", "100%",
            "height", "100%",
            "align", "middle",
            "id", "MyFirstProject", 
            "quality", "high",
            "bgcolor", "#869ca7",
            "name", "MyFirstProject", 
            "allowScriptAccess","sameDomain",
            "type", "application/x-shockwave-flash",
            "pluginspage", "http://www.macromedia.com/go/getflashplayer"
        );
    }
    
    

    In the second script block, change the src, id, and name parameters to match your SWF file's name:

    } else if (hasRequestedVersion) {
        AC_FL_RunContent(
                "src", "MyFirstProject", 
                "width", "100%",
                "height", "100%",
                "align", "middle",
                "id", "MyFirstProject", 
                "quality", "high",
                "bgcolor", "#869ca7",
                "name", "MyFirstProject", 
                "allowScriptAccess","sameDomain",
                "type", "application/x-shockwave-flash",
                "pluginspage", "http://www.macromedia.com/go/getflashplayer"
        );
    }
    
    

    When you edit these methods, you can also add flashVars variables, change the height and width of the SWF file, and set other properties of the SWF file, if necessary. For more information about available properties, see About the object and embed tags. For more information about adding deep linking support, see Deep Linking in the Adobe Flex 3 Developer Guide.

  6. Replace the value of the alternateContent variable with your own custom content. In this step and the next, you can implement alternate methods of upgrading Flash Player for users who do not meet the requirements for Express Install. For more information, see Alternatives to Express Install.
  7. Replace the HTML code found within the <noscript> tag with your own custom content. For more information, see Alternatives to Express Install.
  8. Deploy the playerProductInstall.swf file included in the /templates/express-installation directory to your web server.

    By default, you should deploy this file to the same directory as your Flex application. If you deploy it to another location, you must update the wrapper to point to this new location. This file is also included in your Flex application's bin directory in Flex Builder.