@ACE
You may want to separate your function calls for each type of file.
IE: using your bitmap function for png, jpg, gif, etc.
Then another function that just loads the swf files in a MC the way they come? But I think Henrik is right here, you cant load a SWF as if it was an image. Its a swf. :)
HTH,

Best,
Karl


On Dec 1, 2010, at 3:44 AM, Glen Pike wrote:

Hi,

If your loaded asset is a swf, you cannot just access the bitmapData property - it does not have one.

However, you can draw the contents of a MovieClip / Sprite / DisplayObject into a BitmapData object, which you can then pass to the constructor of a Bitmap.

http://help.adobe.com/en_US/as3/dev/ WS5b3ccc516d4fbf351e63e3d118a9b90204-7d60.html

You should also use the INIT event rather than the COMPLETE event for loaded objects because your SWF may have to initialise when it's loaded and you cannot be guaranteed that height, width and child clips are on stage.

    HTH

    Glen

On 30/11/2010 19:18, ACE Flash wrote:
hi there,

I am pulling my hair off :), i was able to use any PNG or JPG file in my code, the SWF file just didn't work. Would you please take a look for me? Is
there anything I am missing??

I am using flash 9 and all files are on the same domain. Thanks

====================================

import flash.net.URLRequest;import flash.display.Loader;

// I am able to use the PNG/JPG files

var fileURL:String = "http://www.google.com/images/logos/ ps_logo2.png"

// BUT!!!  the SWF just doesn't work!!!!, it always return null!

//var fileURL:String = "xxxxx.swf"

var request:URLRequest = new URLRequest(fileURL);
var loader:Loader = new
Loader();loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
dataCompleteHandler);loader.load(request);
function dataCompleteHandler(e:Event):void{
        var image:Bitmap = new Bitmap(e.currentTarget.content.bitmapData);
        addChild(image);}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to