この進行状況バーが機能していません。理由はありますか?
import flash.filesystem.*;
import flash.display.*;
var byteArray:ByteArray = new ByteArray();//Bytes from the URLStream will go here
var loader:Loader = new Loader();
var urlString:String = "http://massmediamail.com/testing/Rosary.zip";
var urlReq:URLRequest = new URLRequest(urlString);
var urlStream:URLStream = new URLStream();
var fileData:ByteArray = new ByteArray();
urlStream.addEventListener(Event.COMPLETE, loaded);
urlStream.load(urlReq);
function loaded(event:Event):void
{
urlStream.readBytes(fileData, 0, urlStream.bytesAvailable);
writeAirFile();
}
function writeAirFile():void
{
var file:File = File.applicationStorageDirectory.resolvePath("000Zip/Rosary.zip");
trace(File.applicationStorageDirectory.nativePath);
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.writeBytes(fileData, 0, fileData.length);
fileStream.close();
trace("The file is written.");
done.text = "Yahoooo!";
more.text = "Now wait for the \"yippie!\"";
//TotalLoaded.text = "Downloaded Zip";
fileStream.addEventListener(ProgressEvent.PROGRESS, onStreamProgress, false, 0, true);
function onStreamProgress(event:ProgressEvent):void
{
TotalBytes.text = "" + event.bytesTotal + "";
bb.text = "" + event.bytesLoaded + "";
}
}