Application type: mobile Titanium SDK: 2.1.2 (08/24/12 14:46 ed7f777) Platform & version: Android 4.1.1 Device: Any Host Operating System: Win7 x64 Titanium Studio: 2.1.2.201208301612
/resources/app.js
var MyApp = {}; Ti.include( 'window.js' , 'test1.js' , 'test2.js' , 'test3.js' ); MyApp.Window.Open(MyApp.Test1);/resources/window.js
(function () { MyApp.Window = {}; // -------------------------------------------------------------------------- MyApp.Window.ActivityIndicator = Ti.UI.createActivityIndicator({ message:'Loading...', width: Ti.UI.SIZE, height:Ti.UI.SIZE, top:'50dp', left:'100dp' }); MyApp.Window.ShowAC = function (activity) { MyApp.Window.ActivityIndicator.show(); MyApp.Window.ACLoaded = true; }; MyApp.Window.HideAC = function (activity) { MyApp.Window.ActivityIndicator.hide(); MyApp.Window.ACLoaded = false; }; MyApp.Window.Open = function (activity) { activity.Window.fireEvent('myapp:loadwin'); activity.Window.open(); }; }());/resources/test1.js
(function () { MyApp.Test1 = {}; // -------------------------------------------------------------------------- MyApp.Test1.Window = Ti.UI.createWindow({ title: 'Test 1' , width: Ti.UI.FILL , height: Ti.UI.FILL , backgroundColor: '#FFFFF' }); // -------------------------------------------------------------------------- function AddControls () { var view = Ti.UI.createView({ width: Ti.UI.FILL , height: Ti.UI.FILL }); var btn = Ti.UI.createButton({ title: 'Test 2' , width: '100dp' , height: '100dp' }); btn.addEventListener('click', function (e) { MyApp.Window.Open(MyApp.Test2); MyApp.Test1.Window.close(); }); view.add(btn); MyApp.Test1.Window.add(view); MyApp.Window.HideAC(MyApp.Test1); }; // -------------------------------------------------------------------------- MyApp.Test1.Window.addEventListener('myapp:loadwin', function (e) { MyApp.Window.ShowAC(MyApp.Test1); AddControls(); }); }());/resources/test2.js
(function () { MyApp.Test2 = {}; // -------------------------------------------------------------------------- MyApp.Test2.Window = Ti.UI.createWindow({ title: 'Test 2' , width: Ti.UI.FILL , height: Ti.UI.FILL , backgroundColor: '#FFFFF' }); // -------------------------------------------------------------------------- function AddControls () { var view = Ti.UI.createView({ width: Ti.UI.FILL , height: Ti.UI.FILL }); var btn = Ti.UI.createButton({ title: 'Test 3' , width: '100dp' , height: '100dp' }); btn.addEventListener('click', function (e) { MyApp.Window.Open(MyApp.Test3); MyApp.Test2.Window.close(); }); view.add(btn); MyApp.Test2.Window.add(view); MyApp.Window.HideAC(MyApp.Test2); }; // -------------------------------------------------------------------------- MyApp.Test2.Window.addEventListener('myapp:loadwin', function (e) { MyApp.Window.ShowAC(MyApp.Test2); AddControls(); }); }());/resources/test3.js
(function () { MyApp.Test3 = {}; // -------------------------------------------------------------------------- MyApp.Test3.Window = Ti.UI.createWindow({ title: 'Test 3' , width: Ti.UI.FILL , height: Ti.UI.FILL , backgroundColor: '#FFFFF' }); // -------------------------------------------------------------------------- function AddControls () { var view = Ti.UI.createView({ width: Ti.UI.FILL , height: Ti.UI.FILL }); var btn = Ti.UI.createButton({ title: 'Test 1' , width: '100dp' , height: '100dp' }); btn.addEventListener('click', function (e) { MyApp.Window.Open(MyApp.Test1); MyApp.Test3.Window.close(); }); view.add(btn); MyApp.Test3.Window.add(view); MyApp.Window.HideAC(MyApp.Test3); }; // -------------------------------------------------------------------------- MyApp.Test3.Window.addEventListener('myapp:loadwin', function (e) { MyApp.Window.ShowAC(MyApp.Test3); AddControls(); }); }());
1 Answer
Ok, Im only guessing here, because this is alot of code to go throwing into a new project, but I would say that you get the black flash because of the background color on your windows. If you look at your code, your background colors look like this: backgroundColor: '#FFFFF'.
Thats only 5 characters in a hex property that needs either 3 or 6. I believe that #FFFFF actually displays as black. Try adding a 6th F to make the proper hex color and the background won't flash as black before you add the rest of the window elements.
Your Answer
Think you can help? Login to answer this question!