6 Replies Latest reply on Nov 19, 2009 1:17 AM by peterv27

    I can't save an Image file to local disk


      Hello, I'm running this simple application to save an image to local disk.


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
           import mx.core.UIComponent;
           import mx.graphics.ImageSnapshot;
           import mx.controls.Alert;
           import mx.rpc.events.FaultEvent;
           import mx.rpc.events.ResultEvent;
           import mx.graphics.codec.JPEGEncoder;
           import mx.events.ColorPickerEvent;
           import mx.controls.Alert;
           import flash.display.Sprite;
           import flash.events.*;
           import flash.net.FileReference;
           import flash.net.URLRequest;
           import flash.net.FileFilter;
           import flash.net.FileReferenceList;
           public var aux1:int = 1;
           public var file:FileReference;
          private function capture():void{
                var jpgEncoder:JPEGEncoder = new JPEGEncoder();
                var bitmapData:BitmapData = new BitmapData(image.width, image.height);
                var ba:ByteArray =  jpgEncoder.encode(bitmapData);
                file = new FileReference();
           <mx:Image id="image" maxHeight="600" maxWidth="800"/>
              <mx:Button label="Save file" click="capture()"/>


      But when a run the application, in this line:




      I get this error:


      "1061: Call to a possibly undefined method save through a reference with satic type flas.net:FileReference"


      Please, what I can do ?


      Thanks in advance,