Mike Morearty
24 Jan 2007

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. 9 for 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. 0 for version 9.0 r28.
${version_revision}
The revision number of the version of Flash that is required to run this app, e.g. 28 for 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 .swf extension, e.g. MyApp or MyApp-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 backgroundColor attribute of the <mx:Application> tag, or, in the case of ActionScript-only projects, in the backgroundColor field 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 the backgroundColor and backgroundGradientColors attributes of the <mx:Application> tag.
${width}
The width of the application, as specified in the width attribute of the <mx:Application> tag, or, in the case of ActionScript-only projects, in the width field 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 height attribute of the <mx:Application> tag, or, in the case of ActionScript-only projects, in the height field 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 pageTitle attribute of the <mx:Application> tag, or, in the case of ActionScript-only projects, in the pageTitle field of the [SWF] metadata attribute of the main application class, e.g. [SWF(pageTitle="flex r00lz")] public class MyApp extends Sprite.
comments powered by Disqus