I've spent the last few days reading and trying to understand the process and logic and I need help with a simple question. I'm extremely new at this. I've looked at and read most the documents and watched the videos.
In my project I do not want a tabletgroup and need it to work on Android, iOS and HTML5.
I don't understand in this example or in an array of data where you tell it the path of the new windows. I think I have a fundamental failure in my thought process and want to clear it up.
In my understanding of web sites I create a html page it might have a url to another html page and so on. But often I see in this code a child but I don't ever see a url of where that child is or the data which is shown on the page isn't in a dedicated .js file.
Am I wrong in thinking each Window should have a .js page
app.js 3 links to page1.js page2.js page3.js 3 links to page3-sub1.js page3-sub2.js page3-sub3.js
each page has it's own text, images and content not effected by the rest?
In the below code from the PathMenu example I understand the event listener but don't see where the url that would open a new facebook window is and where is this facebook page stored? I see e.source but don't see anywhere in the code where source connects facebook to say a facebook.js?
}); var menu = require('/path').createMenu({ iconList: [ { image: 'images/sm/facebook.png', id: 'facebook' }, { image: 'images/sm/pridat.png', id: 'pridat' }, { image: 'images/sm/twitter.png', id: 'twitter' }, { image: 'images/sm/vimeo.png', id: 'vimeo' }, { image: 'images/sm/youtube.png', id: 'youtube' } ] }); var label = Ti.UI.createLabel({ text: 'index: ???\nid: ???', color: '#222', font: { fontSize: 24, fontWeight: 'bold' }, textAlign: 'center' }); menu.addEventListener('iconClick', function(e) { Ti.API.info(e.source); Ti.API.info(e.index); Ti.API.info(e.id); label.text = 'index: ' + e.index + '\nid: ' + (e.id ? e.id : 'undefined'); }); var button = Ti.UI.createButton({ title: 'reset menu', width: 120, height: 40, top: 20 }); button.addEventListener('click', function(e) { menu.initMenu(); label.text = 'index: ???\nid: ???'; }); win.add(label); win.add(button); win.add(menu); win.open();
1 Answer
I would recommend that you look at the structure of the sample projects provided with TiStudio. They show a commonJS structure that can be useful for creating applications
http://docs.appcelerator.com/titanium/2.1/index.html#!/guide/Example_Applications
http://docs.appcelerator.com/titanium/2.1/index.html#!/guide/Best_Practices_and_Recommendations
Your Answer
Think you can help? Login to answer this question!