Actionscript 3 bytearray到位图场景

Actionscript 3 bytearray到位图场景,actionscript-3,Actionscript 3,我只有一个字节数组,没有位图。我正在使用下面的代码转换为位图,但我最终得到了文件结束错误 //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.hei

我只有一个字节数组,没有位图。我正在使用下面的代码转换为位图,但我最终得到了文件结束错误

//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);

我用装载机使它工作

    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loading1);

    loader.loadBytes(rstream);
function loading1(e:Event):void
{
    var image:Bitmap = Bitmap(e.target.loader.content);

    myPuzzle.source = image;
}

rstream
包含哪些内容?您是如何填充它的?bytearray来自哪里?bytearray来自我的一个应用程序,它将用户输入作为图像。我只是通过使用加载器概念使它工作。我已经粘贴了下面的代码