Hi everyone,
I started today with appcelerator for mobile (iPhone). I would like to download a serie of images from an URL, for example 'http://www.domain.com/images/'
In this folder there are images, named: photo001.JPG, photo002.JPG, photo003.JPG etc.. Is it possible to download these images and put them in some kind of coverflow?
Thnk you :)
3 Answers
Yes, you can put the array of images into a CoverFlowView ... see the API docs for details: http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.CoverFlowView-object
This is what I use. This code is from the kitchen sink app. All I did was parse the inforation that I needed.
var images = []; for (var i = 0; i < json.length; i++){ var image = ({image: 'http://www.blabla.com/admon/userfiles/vestido/' + json[i].MediumPath, width: 200, height: 260, dressID: json[i].idvestido}); images.push(image); } // create coverflow view with images var cfv = Titanium.UI.createCoverFlowView({ images: images, backgroundColor: '#000', height: 300, opacity: 1, });
Adding my bit: It's all a matter of populating the image array with image URL's. To read from a directory, a good approach is to create a JSON webservice returning the image array in JSON. In php you can use readdir() and json_encode() (php version 5.2 minimum).
Your Answer
Think you can help? Login to answer this question!