我想显示使用Bitmap作为源的图像。我已经看过很多网站,并且大多数人会提出类似于此的内容,但不知何故,它仍然无法正常工作。希望有人能帮助。我觉得这是很简单的东西,我没有看到...有人可以告诉这段代码片段有什么问题吗?
IMG1正常工作......但IMG2不加载由于某种原因。
private function onComplete(event:Event):void{
_bytes = event.target.data;
img1.source = _bytes; /*this last bit works*/
_bmpData = new BitmapData(img1.width,img1.height);
_bmpData.draw(img1,new Matrix());
_bmp = new Bitmap(_bmpData);
img2.source=_bmp;
}
什么样的对象都是IMG1和IMG2 ?我不知道是什么对象具有属性.source但我猜你的问题很简单,img2.source应该是中BitmapData,而不是位图。 – jhocking
只是正常的火花图片...我改变了我的代码,以便'img2.source'接收的BitmapData而不是位图,但仍然没有去。 –