Download Assets at Runtime in SWF Format
Hi,
I am developing a game in AIR for mobile that has certain visual assets that may change with the seasons. Imagine a set of four characters: George, Paul, John, and Ringo. The images, music, movie clips, etc., for these characters are bundled into a SWF which I donwload from my server at runtime. At Chrismastime, I replace the SWF file on my server with a Christmas themed version (John's wearing a Santa hat, and the game's theme music takes on a festive tone).
To access the resources in the SWF after I load it from the remote server, I would grab the loader and instantiate classes in ActionScript, with code along these lines (this example is using greensock's LoaderMax):
private function getDisplayObject (name:String):DisplayObject
{
var ClassRef:Class = _assetsSwfLoader.getClass(name);
if (ClassRef)
{
return new ClassRef() as DisplayObject;
}
else
{
throw new Error("Cannot find class " + name + " in " + _assetsSwfLoader.url);
}
}
The problem is with iOS. I don't think that I am allowed to download and crack open a SWF file on iOS, because Apple might consider that "downloadable code" and therefore Adobe's iOS runtime won't allow it.
Am I right? Wrong? Is there a way to open SWF files and extract playable movieclips (or other DisplayObjects) on iOS under AIR?
// thanks! // greg //
