I am checking for the Loader class on the ios platform.Surprisingly I am never able to load any transparent png as tranparent, a white background is always added to that when i load image from the CameraRoll using loadFilePromise() method of loader.
It seems that there is some big difference between loadFilePromise() and load() method of the Loader for the transparancy.
As per my code loadFilePromise() is adding additional background color i.e. white on the transparent images,While the things work perfectly for the load() method if we are passing any url of transparent image inside this.
I have set the opaqueBackground = null in both cases.
If any body have any idea please confirm this.
Thanks in Advance,
Shardul
Below code will always show me a transparent png with white background:-
private var cameraRoll:CameraRoll = new CameraRoll();
protected function browseForImage(event:MouseEvent):void
{
if( CameraRoll.supportsBrowseForImage )
{
cameraRoll.addEventListener( MediaEvent.SELECT, onImageSelect );
cameraRoll.browseForImage();
}
}
private var imageLoader : Loader;
private function onImageSelect( event:MediaEvent ):void
{
var imagePromise:MediaPromise = event.data;
imageLoader = new Loader();
imageLoader.opaqueBackground = null;
if( imagePromise.isAsync )
{
imageLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, imageLoaded );
imageLoader.loadFilePromise( imagePromise );
}
}
private function imageLoaded( event:Event ):void
{
var myLoaderInfo:LoaderInfo = event.target as LoaderInfo;
var tempBitmapData : BitmapData = new BitmapData(myLoaderInfo.width, myLoaderInfo.height,true,0x00000000);
tempBitmapData.draw(myLoaderInfo.loader);
myImage.source = new Bitmap(tempBitmapData);
}
---------------------------------------------------------------------- ---------------------------------------------------------------------- -------------------------
While the code below always shows me the transparent png:-
private var imageLoader : Loader;
protected function button1_clickHandler(event:MouseEvent):void
{
imageLoader = new Loader();
imageLoader.opaqueBackground = null;
imageLoader.contentLoaderInfo.addEventListener( Event.COMPLETE,onImageLoaded);
imageLoader.load(new URLRequest("Any Tranparent Image url here"));
}
private function onImageLoaded( event:Event ):void
{
var myLoaderInfo:LoaderInfo = event.target as LoaderInfo;
var tempBitmapData : BitmapData = new BitmapData(myLoaderInfo.width, myLoaderInfo.height,true,0x00000000);
tempBitmapData.draw(myLoaderInfo.loader);
myImage.source = new Bitmap(tempBitmapData);
}
myImage is a bitmap image in both the cases.
Shardul
I'm not saying this _is_ the case, but I found it in a similar situation (loading swfs into iOS) and eventually traced it to the s:Group that was containing it all - at the end of updateDisplayList() it was drawing a white background for no good reason. As a workaround, I simply overrode updateDisplayList and called super.updateDisplayList(w,h); then graphics.clear() on the relevant s:Group
G
Hi all,
I have reported this as bug,
https://bugbase.adobe.com/index.cfm?event=bug&id=3292398
If anyone have any workaround will appriciated.
One major concern is that the same code works perfectly for the android too.
North America
Europe, Middle East and Africa
Asia Pacific