I'm trying to make a simple image gallery but I keep running into errors could some please help me I'm a noob to this stuff.. I want to make a home tab and a gallery tab and have the gallery scrollable.
This is the code i have so far: Titanium.UI.setBackgroundColor('#000');
// create tab group var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
navBarHidden: true
//backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Home',
window:win1
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Gallery',
window:win1
});
var label1 = Titanium.UI.createLabel({ backgroundImage: 'coffeeLogo.jpg', width: 320, height: 480, //color:'#999', //font:{fontSize:20,fontFamily:'Helvetica Neue'}, //textAlign:'center',
});
//scrollview
scrollingView = Titanium.UI.createScrollableView({ left: 17, top: 15, width: win1.width - 14, height: win1.height - 25, views: [], currentPage: 0, zIndex: 1 }); scrollingView.addEventListener('scroll',function(e){ Ti.API.info('Current scrollableView page = ' + e.source.currentPage); }); win1.add(scrollingView);
Ti.API.debug('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
// set image view
var imgView = Titanium.UI.createImageView({
top: 0,
left: 0,
width: 286,
height: 337,
image: image
});
scrollingView.addView(imgView);
}
2 Answers
scrollingView.addEventListener('scroll',function(e){})In your eventHandler function you pass in params as the variable
e and inside the function you reference it as event
event.mediaType
Your Answer
This question has been locked and cannot accept new answers.