Skip to Main Content
Automating ActionScript Projects with Eclipse and Ant
book

Automating ActionScript Projects with Eclipse and Ant

by Sidney de Koning
October 2011
Intermediate to advanced content levelIntermediate to advanced
98 pages
2h 18m
English
O'Reilly Media, Inc.
Content preview from Automating ActionScript Projects with Eclipse and Ant

Setting Up the HTML File

The standard practice is to test a Flash project or SWF within an HTML file. The big plus with this approach is that if we need to test using FlashVars, we can do so with relative ease from within the HTML. So next we will create an HTML file from scratch. We’ll do this via the echo task in Ant, because it allows us to easily write to a file. But how do we automatically get the project properties in our HTML? Well, we are going to do something new here: work with tokens, and replace them with real values.

The advantage with token replacement is that we can work with template files—whether they are physically on the filesystem, or saved in properties/strings and generated with code. For now, we are choosing the latter.

The HTML we are creating has the following tokens:

  • @html.title@

  • @html.bgcolor@

  • @html.width@

  • @html.height@

These are placeholders for the code to be, which is the value we will replace using Ant so this can become a working HTML file. Of course, you can replace anything you want.

So, first, we need to create a target that will write the HTML. And since we want to distribute only the build files and property files, we want to try to generate as much as possible with Ant.

The way of embedding the SWF file in the HTML normally requires a JavaScript file called SWFObject. As of version 2, you can include this file straight from its repository, which means no more distributing extra unnecessary files. Just make a call to http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

AdvancED ActionScript 3.0: Design Patterns

AdvancED ActionScript 3.0: Design Patterns

Ben Smith
ActionScript 3.0 Cookbook

ActionScript 3.0 Cookbook

Joey Lott, Darron Schall, Keith Peters
Migrating to Swift from Flash and ActionScript

Migrating to Swift from Flash and ActionScript

Radoslava Leseva Adams, Hristo Lesev

Publisher Resources

ISBN: 9781449314736Errata PageSupplemental Content