Working code can't see vars after moving into an include file
Hey, got a big chunk of code that works great. moved it to an include file and added Ti.include('filename.js')
and started getting "can't find variable x' errors.
The include line is placed in the exact same spot where the orig code was so it should look exactly the same at run-time.
Probably something staring me in the face!
Thx!
5 Answers
-
I have had the same issue and as a result I have not migrated to 1.4.X
-
Does
Titanium.include
work? As opposed toTi.include
? -
Bump.
-
I use an included file to set colors and common styles. I put the include statement in my app.js file and the variables are all available in my other files. See the "Global Context and Threading" section at http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI-module
I'm using
Titanium.include('styles.js');
to include the file. Then, I can use its variables throughout the rest of my script. Statements like the following also work for me to include a file and open the window it defines:Titanium.include('profilepicker.js'); // defines pickwin window pickwin.open();
See the "Passing Data" section at http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Window-object for info on passing data between windows/files.
I'm using the newest Titanium developer (title bar says 1.2.1 but I downloaded it last week) with the nightly builds of the 1.4.1 api (1.4.0 were very buggy).
Tim
-
The issue has been resolved for both platforms since this thread was started. See TIMOB-1662.
Cheers