royale-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [royale-asjs] aharui edited a comment on issue #878: mx:Image uploading is not working
Date Wed, 01 Jul 2020 15:56:44 GMT

aharui edited a comment on issue #878:
URL: https://github.com/apache/royale-asjs/issues/878#issuecomment-652491805


   Loading images from loaded data is trickier in Royale because the browser can't handle
image data like Flash does.  Your code will have to detect the file type and encode the data.
   
   ```
   		import mx.utils.ByteArray;
   		import org.apache.royale.utils.Base64;
      
          COMPILE::JS {
           var encodedData:String = Base64.encode(strFileRef.data as ByteArray);
   	profilePic.applyImageData("data:image/png;base64," + encodedData);
           }
   ```
   
   I think you have to swap out `image/png` for `image/jpeg` and other formats depending on
what got loaded.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message