Quantcast
Channel: Adobe Community : Popular Discussions - Flex (Read Only)
Viewing all articles
Browse latest Browse all 46188

download file without prompt window in flex?

$
0
0

how i can download a file from remote server without prompt window(where to save file) in flex.i have already downloaded file from remote server,but during downloading i am getting a prompt window(where to save file).?below is the code which i am using.....................,i want downloaded file is saved to default location on system without prompt window?

 

 

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

<mx:WindowedApplication

 

 

xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

 

 

<mx:Script>

<![CDATA[

 

 

 

 

import mx.controls.Text;

 

 

import mx.controls.Alert;

 

[

Bindable]

 

privatevar fileRef:FileReference = null;

 

 

privatefunction downloadFile():void{

 

 

var urlRequest:URLRequest = new URLRequest("http://appldnld.apple.com/iTunes9/061-7656.20100616.ZTns2/iTunesSetup.exe");

fileRef =

new FileReference();

fileRef.download(urlRequest,

"iTunesSetup.exe");

fileRef.addEventListener(ProgressEvent.PROGRESS, setDownloadProgress);

fileRef.addEventListener(Event.COMPLETE, completeHandler);

 

 

 

}

 

 

privatefunction setDownloadProgress(event:ProgressEvent):void{

 

pbProgress.setProgress(event.bytesLoaded, event.bytesTotal);

pbProgress.label =

"Downloading [" + Math.round(event.bytesLoaded / event.bytesTotal * 100).toString() + "%]";

 

 

}

 

 

privatefunction completeHandler(event:Event):void{

 

fileRef =

null;

Alert.show(

"Download Completed");

 

}

 

 

 

]]>

</mx:Script>

 

<mx:VBox

 

 

top="10" left="10">

 

 

<mx:Text buttonMode="true" click="downloadFile()" text="Download File" textDecoration="underline" fontSize="12"/>

 

 

<mx:ProgressBar visible="{fileRef != null}" mode="manual" label="" id="pbProgress" labelPlacement="center"/>

</mx:VBox>

 

 

 

 

</mx:WindowedApplication>


Viewing all articles
Browse latest Browse all 46188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>