Download Manager is a native extension to manage the download of big files. When a game requires a significant amount of assets, it’s wide to download them separately to keep the application size smaller (often a requirement for it to be published). The classic Flash APIs can help with downloads, but they are very limited. For instance downloads are not resumable  and they are fetched using only one download channel .

The Download Manager extension fully automates the process, allowing a developer to download big files as fast as possible by downloading the data in chunks. Additionally it is possible to resume a download in case of anything goes wrong, which is something that users expect to happen. A developer can also decide what sections/chunks to download, manage queue for downloads, start more than one download at a time and read download status.


private var _ex:DownloadManager = new DownloadManager();
private var _currDownloadId:int;

// add the required listeners to know how the download progress goes
_ex.addEventListener(DownloadManagerEvent.ERROR, onError);
_ex.addEventListener(DownloadManagerEvent.CONNECTION_LOST, onConnectionLost);
_ex.addEventListener(DownloadManagerEvent.PROGRESS, onProgress);
_ex.addEventListener(DownloadManagerEvent.PAUSED, onPaused);
_ex.addEventListener(DownloadManagerEvent.COMPLETE, onComplete);

// there's also the following listener which outputs a lot of other information about your download tasks. please study this listener on your own time:
// _ex.addEventListener(DownloadManagerEvent.STATUS, onStatus);
// private function onStatus(e:DownloadManagerEvent):void
// {
//   trace("download id: " +, "download state: " + e.param.state) // refer to DownloadStates class to know what download states mean.
// }

// setup the download manager default values
_ex.setupLib(null, 5);

// introduce a new download task
_currDownloadId = _ex.setupDownload("", "dm_AIR", DownloadManager.PRIORITY_HIGH, null, 0, false);
trace("Download id = " + _currDownloadId);

// start the download

// pause the download like this:
// _ex.pause(_currDownloadId);

// get status of a task like this
var obj:Object = _ex.getStatus(_currDownloadId);
for (var name:String in obj) {
    trace(name + " = " + obj[name])

private function onError(e:DownloadManagerEvent):void {

private function onConnectionLost(e:DownloadManagerEvent):void {
    trace("connection lost for id: " +

private function onProgress(e:DownloadManagerEvent):void {
    trace("id: " +, "    %" + e.param.perc + "   bytes: " + e.param.loadedBytes)

private function onPaused(e:DownloadManagerEvent):void {
    trace("paused for id: " +

private function onComplete(e:DownloadManagerEvent):void {
    trace("Completed for id: " +
Air Native Extension, Android . URL.