An Approach to setting wmode for Stage3D project in Flash Builder

Posted on December 2, 2011 | 2 comments

There are a lot of posts on how to configure projects to get up and running with Stage3D. With Flash Builder 4.6 and Flex 4.6 SDK some of the steps are not needed, like getting a different playerglobal.swc and setting the -swf-version=13. But you still need to set the wmode="direct" in the index.template.html for Stage3D content to run.

Reading a bunch of posts some people just change this by hand for each project. Others post about how to change the index.template.html in the SDK templates folder. A drawback with this last approach is then all your projects will have wmode="direct" turned on, which is not necessarily bad but could cause issues in some cases.

My approach is a middle ground, I add a new template file to the templates that has the wmode="direct" enabled. Then you have the option to use the wmode="direct" by just changing your run configuration to point to this new template html file. Which I call direct.template.html and it comes out as direct.html in the bin-debug folder along side the AppName.html file. The drawback here is if you have projects that have multiple applications it will only copy over this second template for the default application. For this specific drawback you can just copy the direct.template.html over index.template.html (since direct.template.html will be in the project) and then have all them set to direct. This still gives you control over what you project should run at but not go looking for how to modify the index.template.html for each new project. Read on to see the steps I take to setup this up.

Steps to add direct.template.html and change run configuration

  • Download or copy source from and save it as direct.template.html in the following folder:
    • Win: C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0\templates\swfobject
    • Mac: /Applications/Adobe Flash Builder 4.6/sdks/4.6.0/templates/swfobject
  • Create a new Flex or ActionScript Project (web not mobile). Check to see if direct.template.html is in the html-template folder.
  • Run the application once to create default run configuration.
  • Click on Run -> Run Configurations…
  • Select the Project’s run configuration and deselect “Use default” in the “URL or path to launch”
  • Change the last .html file name to “direct.html”, leaving the rest of the path the same. See image below:
  • Shawn Makinson

    Mobile info?

    • Anonymous

      When Stage3D comes for mobile it will be direct in the app.xml file.