You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/07/01 15:36:03 UTC

[GitHub] [royale-asjs] aharui commented on issue #878: mx:Image uploading is not working

aharui commented 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;
   
           var encodedData:String = Base64.encode(strFileRef.data as ByteArray);
   	profilePic.source = "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