Flash Facebook app...loaded images are invisible...why?
Hi Created a simple gallery in flash for a facebook application. Everything works fine locally, and when uploaded to our staging server the images seem to load but they are invisi开发者_JS百科ble.
I AM creating a LoaderContext file and passing true as a parameter so this isn't the issue.
Anyone have any ideas?
//CODE START
_lctx=new LoaderContext(true);
//or _lctx.checkPolicyFile = true;
_my_loader.load(new URLRequest(smallImg), _lctx);
//CODE END
I have issues with images not loading with flex in the past. I need some more details, but when I've had issues I found that loading the image into a new bitmap object worked ok:
var imgReq:URLRequest = new URLRequest(source+"");
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
imgCompleteHandler);
imgLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
imgLoader.load(imgReq);
function imgCompleteHandler(evt:Event):void {
var loader:LoaderInfo = evt.currentTarget as LoaderInfo;
var bmp:Bitmap = loader.content as Bitmap;
var bmd:BitmapData = bmp.bitmapData;
image.source = new Bitmap(bmd);
}
Not sure whether this is what your are looking for. We came across the same problem while developing a facebook app in flash. Turns out that we need a Crossdomain.xml file to render images in staging.
精彩评论