0 Replies Latest reply on Aug 4, 2009 9:51 AM by chandler124

    download from FileReference = Problem

    chandler124

      Hello,

       

      I want to create a button which allow you to download a file on the server but when I click on it, nothing happens. Can you help me? please

       

      Code :
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="1308" height="1496">
           <mx:Text y="35" text="Mon CV" horizontalCenter="0"/>
           <mx:List  id="listcv" y="82" height="70" dragEnabled="true" color="black" horizontalCenter="0">
               <mx:Array>
                      <mx:String>PDF</mx:String>
                      <mx:String>WORD</mx:String>
                      <mx:String>PAGES</mx:String>
               </mx:Array>
          </mx:List>
          <mx:Script>
               <![CDATA[
          import flash.net.URLRequest;
          import flash.net.FileReference;
                    private function downloadFile():void {
                          var fileRef:FileReference = new FileReference();
                          fileRef.download(new URLRequest ("src/images/CV.pdf"));
                     }
                ]]>
          </mx:Script>
          <mx:Button y="160" label="Télécharger" click="downloadFile()" id="bouton" horizontalCenter="0"/>
           
      </mx:Canvas>

       

      Thank you