I am trying to load an swf and display it as a Bitmap.
So far I have been able to load the swf:
loader.load(new URLRequest("assets/floorplan.swf"));
loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, initPic);
Now on load completion I am looking to take this swf and convert it to Bitmap like so:
public function initPic(loadEvent:flash.events.Event):void
{
container.addEventListener(MouseEvent.CLICK, zoom);
bitmapData = Bitmap(LoaderInfo(loadEvent.currentTarget).content).bitmapData;
image = new Bitmap(bitmapData);
spImage.addChild(image);
container.addChild(spImage);
}
However I am getting an error saying TypeError: Error #1034: Type Coercion failed: cannot convert flash.display to flash.display.Bitmap.
What am I doing wrong?
container.addChild(LoaderInfo(loadEvent.currentTarget).content);
after adding your click listener (regardless of if you're loading a swf or image). Keep using the SWF if it's vector (shape) graphics. Otherwise a PNG will be the same quality assuming it's native resolution – BadFeelingAboutThis