0 Replies Latest reply on Jun 9, 2011 9:07 AM by Little Brain

    How to Load an image from a network drive, AIR app, Flex 4

    Little Brain

      Hi, I'm trying to dynamically load an image into my AIR application, built using Flash Builder 4.

       

      I've checked everything I can think of. At runtime, I can load an image from the local file system but when I try to get my image from the network drive, it just comes up blank. If I embed the network image so that it is loaded at compile time, it shows up fine. The system only fails on runtime, network drive.

       

      I have set the compiler option -use-network=true

       

      Below is my code.

       

      private function preview(evt:MouseEvent):void {

      imagePreview.load("//networkdrivename/preview.jpg");

      }

       

      <s:Button x="56" y="1" label="Preview" id="btnPreview"

        click="preview(event);" />

       

      I'd be very grateful for any suggestions/assistance.

       

      UPDATE: the solution seems to be to link to a mapped drive, and to add extra backslashes. So a file name like this works:

      imagePreview.load("K:\\preview.jpg");

       

      My immediate problem is solved, but I'd be grateful if anybody can explain to me why the \\ is required?