Hi! I'm using Ming to create an library swf, using the first code example below. How can I access the embedded png from my Flex application? Here's the php/ming code:
<?php
// Ming to create Library.swf
//-----------------------------------
// Create background...
Ming_setScale(20.0000000);
$movie = new SWFMovie();
ming_useswfversion(7);
$movie->setDimension(550,400);
$movie->setBackground(200, 200, 200);
// Load png file...
$img_file = "src/assets/page0.png";
$png = new SWFBitmap(fopen($img_file, "rb"));
// Add png to movie...
$movie->add($png);
// Export png
$movie->addExport($png, 'png');
$movie->writeExports();
// Save movie to swf
$swfname = dirname(__FILE__);
$swfname .= "/bin-debug/Library.swf";
$movie->save($swfname, 9);
?>
And here's my flex essay:
// Loading Library.swf (works), trying to access png asset (doesn't work)
private var loader:Loader = new Loader();
private function onCreationComplete():void {
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest('Library.swf'));
}
private function onComplete(e:Event):void {
var resourceClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("png") as Class;
}
I'm not sure that the png is exported properly. Testing the Library.swf with SwfUtils code (swfutils.riaforge.org) doesn't show any exported classes at all. Or maybe something else is wrong?