Hi all,
Having an unusual problem with creating a controller. The code I modeled it from works fine. Using the following:
- Ti SDK 3.1.2
- ios 7.x simulator
- mobile app
- Mac OS X Mavericks
- Titanium Studio, build: 3.1.3.201309132423
Things I've tried with no success:
- clean/rebuild project
- comment out open() call in target file and rewrote controller call as
controller.getView().open();
- compared my code with solutions found in this forums
- ensured I have appropriate controller and view files.
In my index.js
file, I pop an alert on a Register button to allow the user to choose to register as either a user or vendor. That works fine. The problem occurs after an option is clicked. Here's the code:
var helper = require('helpers'); $.registerButton.addEventListener('click', function(e) { var popup = helper.showDialog({ cancel : 2, title : "Registration", message : "Register new?", buttonNames : ['User', 'Vendor', 'Cancel'] }); popup.addEventListener('click', function(e) { //If user does not press Cancel, then navigate to appropriate register page. if (e.index !== 2) { if (e.index === 0) { var controller = Alloy.createController('registerUser'); controller.getView(); } else { var controller = Alloy.createController('registerVendor'); controller.getView(); } } }); }); $.index.open();I open the selected controller in their respective .js files. When I choose User or Vendor button (in this case, User), I get the dreaded Red Screen of Death. The message
undefined is not a function (evaluating $.registerUser.open()) at registerUser.js (line 52).
Line 52 = $.registerUser.open();
No big surprise there. That's the only command in the registerUser.js file. What am I missing here? Hope I've provided enough detail. If not, please ask.