我有flex移动客户端,它以java服务器byte[]作为flash.utils.ByteArray,但是当我想要使用我的bitmapImage编译器的源代码时,它会显示未知的类型:
private function onResult3(event:ResultEvent,token:Object):void
{
if(event.result!=null)
{
var Lder:Loader=new Loader();
var ba:ByteArray=event.result as ByteArray;
Lder.loadBytes(ba);// exception is thrown here
doktorResim.bitmapData.draw(Lder);
}
}有什么帮助或建议吗?
发布于 2012-05-23 14:30:29
如果Java正确地读取和发送字节,那么您需要等待flex加载所有字节,因为它使用了LoaderInfo的event complete参见Loader类
var url:String = "http://www.helpexamples.com/flash/images/image2.jpg";
var urlRequest:URLRequest = new URLRequest(url);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);
loader.load(urlRequest);
addChild(loader);
function loader_complete(evt:Event):void {
var target_mc:Loader = evt.currentTarget.loader as Loader;
target_mc.x = (stage.stageWidth - target_mc.width) / 2;
target_mc.y = (stage.stageHeight - target_mc.height) / 2;
}希望能有所帮助
https://stackoverflow.com/questions/10478094
复制相似问题