ProblemYou want to monitor download progress. SolutionListen for the progress event. DiscussionYou can monitor the progress of a file(s) as it downloads by using the progress event. Every time part of the file downloads to the user's computer, the FileReference object dispatches a progress event of type ProgressEvent. You can use the ProgressEvent.PROGRESS constant to add a listener, as follows: fileReference.addEventListener(ProgressEvent.PROGRESS, onFileProgress); The progress event object has two properties, bytesLoaded and bytesTotal, which return the bytes that have downloaded and the total bytes, respectively. The following example method uses the values of those properties to display the download progress in a text field called fileProgressField: private function onFileProgress(event:ProgressEvent):void { fileProgressField.text = event.bytesLoaded + " of " + event.bytesTotal + " bytes"; } When the file has completed downloading, the FileReference object dispatches a complete event of type Event. Use the Event.COMPLETE constant to add a listener: fileReference.addEventListener(Event.COMPLETE, onFileComplete); See AlsoRecipe 23.1 |