這裏是我的代碼有什麼不對我JPGEncoder
if (event.target.content is Bitmap)
{
infotext.text = "got something";
var image:Bitmap = Bitmap(event.target.content);
var bitmapData:BitmapData = image.bitmapData;
this.addChild(image);
var j:JPGEncoder = new JPGEncoder(100);
var bytes:ByteArray = new ByteArray();
bytes=j.encode(bitmapData);
}
else
{
throw new Error("What the heck bob?");
}
當我運行調試會話一切正常,直到它達到行
bytes=j.encode(bitmapData);
沒有任何反應後,我的程序公正進入緩衝區請幫助
我根據您的建議對代碼進行了更改
var myImage:Bitmap =Bitmap(e.target.content);
var bitmapData:BitmapData = new BitmapData(myImage.width,myImage.height,true,0xffffffff);
bitmapData.draw(myImage);
var encoder:JPGEncoder = new JPGEncoder();
var bytes:ByteArray = encoder.encode(bitmapData);
this.addChild(myImage);
,但它得到
var bytes:ByteArray = encoder.encode(bitmapData);
我在做什麼錯在這裏後,再次卡住?
你確定bytes.j.encode(bitmapData); 您發佈的代碼中沒有該行。 –
對不起,這是一個錯字,但你知道我的意思 – hitek
只是驗證它是你的文章中的錯字,而不是在你的代碼。 –