Hi everyone,
I’m currently integrating one of my games with the SDK of a certain publisher (who shall remain nameless), but I’m having real problems. They require all games to load their content (ie. images, sounds etc) from an external SWF, like so:
private var __gameScreen:MovieClip;
private function onContentSwfLoaded(result:MediaLoaderResult):void
{
// Store our content and add it to the stage
var contentSWF:MovieClip = result.content as MovieClip;
assert(contentSWF != null, "content swf is null");
// Create a reference to the game screen movieclip in the content SWF
__gameScreen = contentSWF.stateGame;
// Set up the game timeline
addChild(__gameScreen);
}
The problem here is that I really don’t want to have to use MovieClips as all of my games use nothing but BitmapData, so I’m wondering if there’s a way of extracting a Bitmap or BitmapData from an SWF? It doesn’t appear that Flash CS3 caters for this though - you can assign an “instance name” to a MovieClip, but not a Bitmap as far as I can tell. I usually develop in Flex Builder 3 but I’ve not managed to extract anything from an SWF exported from it, probably because you can’t assign instance names to objects, I’m guessing. My current work-around for this problem is to draw each MovieClip to a BitmapData object, but this is very long-winded and probably not too efficient either. Anyway, enough of my ramblings - if anyone could give me some idea of where I’m going wrong (assuming I’m going wrong), I’ll buy you a pint or three!
Cheers,
Mike.