1 Reply Latest reply on Jul 14, 2013 2:43 PM by markerline

    How to load an image from file system onto canvas?

    markerline Level 4



      I want to load an image from the file system on Windows onto the canvas in Flex.


      I have some code I could share but perhaps someone knows of a good tutorial that I can follow.  The code that I have is a hodge-podge of two different tutorials, one for bringing up the file system dialog box and the other for displaying images using this link:

      http://help.adobe.com/en_US/flex/using/WSc5cd04c102ae3e97-33ad5caa12c719dc7c8-8000.html#WS c5cd04c102ae3e97-33ad5caa12c719dc7c8-7ffe


      However I cannot seem to get the image to load even when I select it.  I don't know if it has to be a certain size for the image to render on the display object or canvas.

        • 1. Re: How to load an image from file system onto canvas?
          markerline Level 4

          I figured out one way of doing it by viewing a solution at this location for determining the current location in the file system by mouse click:




          With this simple solution I appended a spark image component and set the source to be the same as the previous path that was given as the current variable disk location.  I can post the complete code if anyone wants to know.  I didn't skin the Image component, nor did I perform any scaling.  The image appears as soon as you click on one in the file dialog.  Ideally I would like the system file dialog to appear and then disappear and only remain with the image that I selected in the dialog box.  That way I can display the contents without clutter and also display the contents in an application I am working on.  If anyone has any input that would be greatly appreciated.  Ideally I would work on spark components rather than mx&spark but I'll take what I can get at this stage.

          1 person found this helpful