Any assistance on what to change or what code to use would be greatly appreciated - below is code from a view that opens up after a user clicks a table row and what I am trying to do is get a movie to play when the user clicks that label "Play Movie" but I can't seem to get it to get it to work.
var win = Titanium.UI.currentWindow; win.backgroundColor = '#FFF'; win.orientationModes = [ Titanium.UI.PORTRAIT, ]; var vertScrollView = Titanium.UI.createScrollView({ contentWidth:'auto', contentHeight:'auto', top:0, bottom:0, showVerticalScrollIndicator:true, showHorizontalScrollIndicator:false }); var view = Ti.UI.createView({ backgroundColor:'#fff' }); vertScrollView.add(view) var pic = Ti.UI.createImageView({ image:'../images/pic.png', left:0, height:300, width:320, top:0, }) view.add(pic); var movielabel = Ti.UI.createLabel({ color:'#000', font:{fontSize:16}, left:10, top:305, right:10, textAlign:'left', text:'Play movie', // height:'auto', // width:'auto' }); view.add(movielabel); movielabel.addEventListener('click', function() { var activeMovie = Titanium.Media.createVideoPlayer({ url:'../images/movie.mp4', movieControlMode : Titanium.Media.VIDEO_CONTROL_DEFAULT, movieControlStyle : Titanium.Media.VIDEO_CONTROL_FULLSCREEN, scalingMode : Titanium.Media.VIDEO_SCALING_MODE_FILL, fullscreen : true, autoplay : true }); var view1 = Ti.UI.createView({ backgroundColor:'#FFF' }); var l = Ti.UI.createLabel({ text:'Top title', width:300, height:'auto', top:12, font:{fontSize:24} }); view1.add(l); var view2 = Ti.UI.createView({ backgroundColor:'#FFF' }); var l2 = Ti.UI.createLabel({ text:'Top Title 2.', width:300, height:'auto', top:10, font:{fontSize:28} }); view2.add(l2); var scrollView = Titanium.UI.createScrollableView({ views:[vertScrollView,view1,view2,], showPagingControl:true, pagingControlHeight:25, maxZoomScale:2.0, currentPage:0 }); win.add(scrollView); var i=1; var activeView = view1; scrollView.addEventListener('scroll', function(e) { activeView = e.view; // the object handle to the view that is about to become visible i = e.currentPage; Titanium.API.info("scroll called - current index " + i + ' active view ' + activeView); }); scrollView.addEventListener('click', function(e) { Ti.API.info('ScrollView received click event, source = ' + e.source); }); scrollView.addEventListener('touchend', function(e) { Ti.API.info('ScrollView received touchend event, source = ' + e.source); });
Your Answer
Think you can help? Login to answer this question!