Download Files using a For Each Loop -
please keep in mind total noob. not asking code entire project, lost in many cases. , patience appreciated ...
my as3 code looks this:
var totalfeatureimagedownloads:number = 0; //total file size of feature images, in bytes var totalfeatureimagedownloaded:number = 0; //total downloaded of feature images, in bytes each(var featureimage:xml in xml.featureimages.imgurl) { trace(featureimage); var featureimagerequest:urlrequest = new urlrequest(featureimage); var featureimageloader:urlloader = new urlloader(featureimagerequest); totalfeatureimagedownloads = totalfeatureimagedownloads + featureimageloader.bytestotal; trace(featureimageloader.bytestotal); }
currently have 3 images in xml file, , url's traced properly. however, bytestotal equals 0. also, know loop creates 3 identically named urlrequest's , 3 identically named urlloaders. need create 3 differently named ones.
i images downloaded simultaneously, , need calculate combined file size three, along download status fraction (bytesloaded / bytestotal).
i have multiple scenarios this, , stuck until finished. appreciated. cheers.
it not possible read bytestotal newly created urlloader, because client needs connect web server first size of file downloaded. need listen first progressevent.progress
event sent urlloader, once event sent bytestotal property more accurate. "more likely" because not possible total file size if data dynamically generated on server, in general case download file server works.
i recognize general scenario. there libraries aid this, such loadermax or bulkloader. use bulkloader: https://github.com/arthur-debert/bulkloader