Send ByteArray to JavaScript

后端 未结 3 1466
夕颜
夕颜 2021-02-14 22:33

How to send a jpg image as ByteArray from as3 to javascript? And how to convert ByteArray to image in javascript?

3条回答
  •  无人及你
    2021-02-14 23:24

    There is a method in this class that does that:

    https://github.com/monkeypunch3/flexcapacitor/blob/master/MainLibrary/src/com/flexcapacitor/utils/DisplayObjectUtils.as

    calling

    var data:String = DisplayObjectUtils.getBase64ImageDataString(); 
    

    will return this string:

    data:image/png;base64,...
    

    You then set the src of an img in html to that value.

提交回复
热议问题