Why doesn't this work

 

The app runs, get a download prompt, click save. No error. But no file. And
the completeHandler never fires, never see the trace.

 

Must be missing something obvious.

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">

      <mx:Script>

            <![CDATA[

                import flash.net.FileReference;

                

                  private function doIt():void {

                        var request:URLRequest = new
URLRequest("http://learncf.com/img/btnTutorial.png";);

                        var fileRef:FileReference = new FileReference();

                        fileRef.addEventListener(Event.COMPLETE,
completeHandler);

                        fileRef.download(request);

                  }

                  

                  private function completeHandler():void {

                        trace('complete');

                  }

            ]]>

      </mx:Script>

      

      <mx:Button x="10" y="10" label="Button" click="doIt();" width="166"
height="126"/>

      

</mx:Application>

 

Regards

Dale Fraser

http://learncf.com

 

Reply via email to