2013-07-25 76 views

回答

4

不,没有。你必须使用Loader通过加载的内容来加载编码JPEG和访问位图数据:

var bitmap:Bitmap = new Bitmap(new BitmapData(100, 100, false, 0xFF0000)); 
    addChild(bitmap); 

    var bytes:ByteArray = new ByteArray(); 
    bitmap.bitmapData.encode(bitmap.bitmapData.rect, new JPEGEncoderOptions(), bytes); 
    bitmap.bitmapData.dispose(); 

    var loader:Loader = new Loader(); 
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(event:Event):void 
    { 
     var bd:BitmapData = Bitmap(LoaderInfo(event.target).content).bitmapData; 

     bitmap.bitmapData = bd; 
    }); 
    loader.loadBytes(bytes); 
[ByteArray的的BitmapData AS3](的
+0

实际上,它是“转回”ByteArray的一种方式。 +1为好的答案。 – Aralicia

+0

这正是我所需要的。谢谢! – Anonymous1

相关问题