dimanche 26 février 2017

Save multiple images with one function - AS3 ADOBE AIR

I've got an Array with 17 web links of images

        var products:Array;

 // Ouput : 

If I do products[10].movieimage; the output will be the 9th link (something like : "http://ift.tt/2le3M7A")

I'm looking for downloading every images without a dialog box.

I manage to do so for 1 image with the specific link, like that :

function saveImage (event:Event):void {

 var stream:URLStream = new URLStream(); 
 var image1:File = File.documentsDirectory.resolvePath("test.jpg"); 
 var fileStream:FileStream = new FileStream(); 

stream.load(new URLRequest("http://ift.tt/2le3M7A")); 
stream.addEventListener(Event.COMPLETE, writeComplete); 

 function writeComplete(evt:Event):void  { 
                var fileData:ByteArray = new ByteArray(); 
                fileStream.openAsync(image1, FileMode.UPDATE); 

Question : Is there a way to download all the images with the web links of my products array ?

If you could show me how, with a bit of code, I could that.

Also, note that I'd like to load the images then in Uiloader, like that :

    function loadImages():void {
uiloader1.source = image1.url;
uiloader2.source = image2.url;

Aucun commentaire:

Enregistrer un commentaire