Hi i had a want to be able to click on the pics in a coverflowview and get them fullsize in another window.
Here is what i got:
function Gallery(albunId){ var net = require('/services/network');//////<<<<<<<---- need to set the right url var self = Ti.UI.createView({ top: 30, bottom: 30, right: 30, left: 30, backgroundColor: '#bcbcbc' }); {//CONVERFLOW var nextUrl = ''; var prevUrl = ''; var view = Titanium.UI.iOS.createCoverFlowView({ images:[], backgroundColor:'#000', top: -125, }); self.add(view); function albunPictures(_data) { if (_data.data.length === 0){ return; } var images = []; for (var c = 0; c < _data.data.length; c++){ images[c]= {image: _data.data[c].source, width:225, height:275}; } view.images = images; view.selected = 0; _data.paging.next ? nextUrl = _data.paging.next : nextUrl = false; _data.paging.previous ? prevUrl = _data.paging.previous : prevUrl = false; } } var url = "http://graph.facebook.com/" + albunId +"/photos";//////<<<<<<<---- need to set the right url var params = { requestType: 'GET', URL: url, } net(params, albunPictures); // click listener - when image is clicked view.addEventListener('click',function(e) {//<<<---this is the convertFlowView // the window to place the image in var imgWindow = Ti.UI.createWindow({ modal: true, barColor: '#050505', backgroundColor: '#050505' }); // The new image view to place the selected image var fullImage = Ti.UI.createWebView({ html: '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2, user-scalable=yes" /><img src="'+ images[e.index].images + '" / Width="100%">', backgroundColor: '#050505' }); // Create a button to close the modal window var close_modal = Titanium.UI.createButton({title:'Stäng'}); imgWindow.rightNavButton = close_modal; // Handle close_modal event close_modal.addEventListener('click', function() { imgWindow.close(); }); // Add the views to the window and open it imgWindow.add(fullImage); imgWindow.open(); }); var next = Titanium.UI.createImageView({ bottom : 1, image : 'images/1.png', zIndex : 10, right: 10, }); self.add(next); next.addEventListener('click',function() { Ti.API.info(nextUrl) if (nextUrl){ var params = { requestType: 'GET', URL: nextUrl, } net(params, albunPictures); } }); var prev = Titanium.UI.createButton({ title: 'Bakåt', bottom: 10, left: 10, }); self.add(prev); prev.addEventListener('click',function() { if (prevUrl){ var params = { requestType: 'GET', URL: prevUrl, } net(params, albunPictures); } }); return self; }; module.exports = Gallery;I guess that the value here
<img src="'+ images[e.index].images + '">is what is wrong i get an error " message = "Can't find variable: images";"
What am i doing wrong???
Here is the network file also
function Network(_args, callback){ var xhr = Ti.Network.createHTTPClient({ timeout: 15000 }); xhr.onload = function(){ callback(JSON.parse(this.responseText)); }; xhr.onerror = function(e){ alert(e.error); }; xhr.open(_args.requestType, _args.URL); xhr.send(_args.functionValues); }; module.exports = Network;
Thanx
//R
Your Answer
Think you can help? Login to answer this question!