Macros that are available in html-template files
In a post last month, I briefly mentioned the list of macro substitutions that are available in the files in the html-template folder. Here, I’ll offer a little more information on those. I’ll try to make sure this makes it into the next version of the documentation.
${project}- The name of the project, e.g.
MyProject. ${application}- The name of the application, e.g.
MyApp. ${version_major}- The major version number of the version of Flash that is required to run this app, e.g.
9for version 9.0 r28. You can change this and the other${version_...}macros by going to Project > Properties, then “Flex Compiler” or “ActionScript Compiler,” and then changing the player version number in the “HTML wrapper” section. ${version_minor}- The minor version number of the version of Flash that is required to run this app, e.g.
0for version 9.0 r28. ${version_revision}- The revision number of the version of Flash that is required to run this app, e.g.
28for version 9.0 r28. ${build_suffix}- This is equal to
"-debug"when building the debug version of the SWF, and""when building the release version. ${swf}- The name of the SWF, not including the
.swfextension, e.g.MyApporMyApp-debug. This is essentially a convenience macro which is equivalent to${application}${build_suffix}. ${bgcolor}- The background color of the application, as specified in the
backgroundColorattribute of the<mx:Application>tag, or, in the case of ActionScript-only projects, in thebackgroundColorfield of the[SWF]metadata attribute of the main application class, e.g.[SWF(backgroundColor="#ffffff")] public class MyApp extends Sprite(see this post for more information on setting the width, height, and background color of an ActionScript project). The result is in the form#rrggbb, e.g.#ffffff. This can actually be a little tricky to use, because by default, the background of a Flex app is actually a gentle gradient from one color to another; if you want the HTML background to match the background of your Flex app, you may need to fiddle with both thebackgroundColorandbackgroundGradientColorsattributes of the<mx:Application>tag. ${width}- The width of the application, as specified in the
widthattribute of the<mx:Application>tag, or, in the case of ActionScript-only projects, in thewidthfield of the[SWF]metadata attribute of the main application class, e.g.[SWF(width="300", height="400")] public class MyApp extends Sprite. ${height}- The height of the application, as specified in the
heightattribute of the<mx:Application>tag, or, in the case of ActionScript-only projects, in theheightfield of the[SWF]metadata attribute of the main application class, e.g.[SWF(width="300", height="400")] public class MyApp extends Sprite. ${title}- The title of the application, as specified in the
pageTitleattribute of the<mx:Application>tag, or, in the case of ActionScript-only projects, in thepageTitlefield of the[SWF]metadata attribute of the main application class, e.g.[SWF(pageTitle="flex r00lz")] public class MyApp extends Sprite.
This is a good reference, thanks mike
Glad to see a compiled list in a clean format. I’d imagine the Flex Docs don’t have a page like this, right? :)
[...] by Adobe, but Renaun Erickson’s posting together with Mike Morearty who nicely documents the marco’s. If you’ve got this far, you need to consider added your FlexUnit’s to [...]