我只有一个字节数组,而不是位图。我正在使用下面的代码转换为位图,但我最终得到文件结束错误。
//rstream is the ByteArray I have
var bytes:ByteArray = rstream;
var rect:Rectangle = new Rectangle(0,0,myPuzzle.width - 20,myPuzzle.height - 20);
var newBmd:BitmapData = new BitmapData(rect.width,rect.height,true,0xFFFFFFFF);
bytes.position = 0;
newBmd.setPixels(rect, bytes);
var image:Bitmap = new Bitmap(newBmd);