Results 1 to 3 of 3
Thread: check loader content
-
October 14th, 2009, 03:36 AM #1280Registered User
postscheck loader content
how can I distinguish between image and swf?
it works for image, but how can i ask if content is swf?
Code:private function completeHandler(e:Event):void { if(e.target.content is Bitmap){ _image = (Bitmap)(e.target.content); } .........
-
October 14th, 2009, 05:17 AM #22,702Seņor Member
postsThe LoaderInfo has a property named "contentType"
http://help.adobe.com/en_US/AS3LCR/F...ml#contentType
Here is some sample usage:
I believe someone on the boards recently found a way that reads the first 3 bytes of the file in order to find out the type.Code:switch(e.currentTarget.loaderInfo.contentType) { case "application/x-shockwave-flash": trace("Loaded content is a SWF."); this.addChild(e.currentTarget.content); break; case "image/jpeg": case "image/gif": case "image/png": trace("Loaded content is an image"); this.addChild(e.currentTarget.content); break; }Blog article of the month: Why My One Line 'if' Statements Are Unusual
Twitter: IQAndreas
GitHub: IQAndreas
-
October 14th, 2009, 05:30 AM #3280Registered User
postsarigato!

Reply With Quote

Bookmarks