views:

32

answers:

1

Someone else wrote and gave me an ActionScript source file that defines a subclass of Sprite. I am told that I need to, from this, generate a .swf file whose behavior is entirely defined by that one sprite. In other words, when the "movie" starts, one instance of that Sprite subclass should be created and set running, and it should keep running until the <object> is destroyed. The sprite doesn't define its own dimensions as far as I can tell, so I also need to know how to specify those (it's supposed to cover the entire area of the movie, and ideally that would not be hardwired into the .swf but rather taken from the <object> definition in the HTML).

I know basically nothing about Flash, and I'm much more of a command line guy than an IDE guy, so if there's a way to write the necessary wrapper in a text editor and then just use the Flash IDE to compile it (or better still, compile it using some sort of command line utility that either came with CS4 or I can install on my Linux box, without paying Adobe an additional arm and leg), detailed instructions on how to do that would be the ideal answer to this question. Failing that, please provide step by step instructions for how to create said wrapper in the IDE. I've got CS4.

The sprite tries to communicate with the containing HTML document, so if there's any glue needed inside the .swf but outside the .as code to achieve that, I need to know how to implement that too.

+3  A: 

Since you already have CS4 you can compile your source file by using the DocumentClass.
http://www.heaveninteractive.com/weblog/2008/03/04/introduction-to-the-document-class-in-actionscript-30-tutorial/

Alternatively, for future reference , if you download the free Flex SDK , you could use the command line to compile your source file

mxmlc SourceFile.as

You can then use SWFObject to embed the resulting swf file in your HTML page
http://learnswfobject.com/

PatrickS
Here's me thinking up a much wordier solution, seeing there were no rapid-fire answers, thanks PatrickS!
Danjah
This is a perfectly good answer and I'm accepting it, but for the record, I was never able to make it work, and eventually I gave up and used haXe instead: http://haxe.org/
Zack