Search code examples
iphonetitaniumappceleratorappcelerator-mobile

Appcelerator ScrollView with image urls


again another question:

I have a scrollView where the images loaded by createView, but how can i add an image from an url? In my case if i change ../images/.... to http://www.codeworxx.com/images/... the images are not loading. In coverFlowView it works?!?!

Any ideas? Here's my code:

var image1      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image1.jpg'});
var image2      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image2.jpg'});
var image3      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/image3.jpg'});
var image4      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/image4.jpg'});
var image5      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/image5.jpg'});
var image6      = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/image6.jpg'});

var scrollView = Ti.UI.createScrollableView({
    views:[image1,image2,image3,image4,image5,image6],
    showPagingControl:true,
    clipViews:false,
    top:0,
    left:30,
    right:30,
    width:320,
    height:156,
    opacity:0
});

Thanks again for your help.

Sascha


Solution

  • Why don't you add Titanium.UI.ImageView to the scrollview.

    There is a good example here of scrolling images. http://shakilspace.blogspot.com/2011/02/appcelerator-titanium-scrollview-swipe.html

    There is also a Titanium scrolling image example app available on Codecanyon http://codecanyon.net/item/swipeable-photo-gallery/145864