Index: lams_central/src/flash/org/lamsfoundation/lams/authoring/Application.as =================================================================== diff -u -r9bef1de27d0d527d75191115a535bc2c4311ade9 -rc0310ef0d1c427e03d4c389bd039adea2361c0c1 --- lams_central/src/flash/org/lamsfoundation/lams/authoring/Application.as (.../Application.as) (revision 9bef1de27d0d527d75191115a535bc2c4311ade9) +++ lams_central/src/flash/org/lamsfoundation/lams/authoring/Application.as (.../Application.as) (revision c0310ef0d1c427e03d4c389bd039adea2361c0c1) @@ -48,8 +48,11 @@ private static var MENU_DEPTH:Number = 25; //depth of the menu private static var UI_LOAD_CHECK_INTERVAL:Number = 50; - + private static var UI_LOAD_CHECK_TIMEOUT_COUNT:Number = 200; + private static var QUESTION_MARK_KEY:Number = 191; + + private var _uiLoadCheckCount = 0; // instance counter for number of times we have checked to see if theme and dict are loaded private var _ddm:DesignDataModel; private var _toolbar:Toolbar; @@ -198,6 +201,7 @@ if(!_UILoadCheckIntervalID) { _UILoadCheckIntervalID = setInterval(Proxy.create(this,checkUILoaded),UI_LOAD_CHECK_INTERVAL); } else { + _uiLoadCheckCount++; //If all events dispatched clear interval and call start() if(_dictionaryEventDispatched && _themeEventDispatched){ Debugger.log('Clearing Interval and calling start :',Debugger.CRITICAL,'checkUILoaded','Application'); @@ -206,7 +210,7 @@ }else { //If UI loaded check which events can be broadcast if(_UILoaded){ - Debugger.log('ALL UI LOADED',Debugger.GEN,'checkUILoaded','Application'); + Debugger.log('ALL UI LOADED, waiting for all true to dispatch init events: _dictionaryLoaded:'+_dictionaryLoaded+'_themeLoaded:'+_themeLoaded ,Debugger.GEN,'checkUILoaded','Application'); //If dictionary is loaded and event hasn't been dispatched - dispatch it if(_dictionaryLoaded && !_dictionaryEventDispatched){ @@ -218,6 +222,13 @@ _themeEventDispatched = true; _themeManager.broadcastThemeChanged(); } + + if(_uiLoadCheckCount >= UI_LOAD_CHECK_TIMEOUT_COUNT){ + //if we havent loaded the dict or theme by the timeout count then give up + Debugger.log('raeached time out waiting to load dict and themes, giving up.',Debugger.CRITICAL,'checkUILoaded','Application'); + //todo: give the user a message + clearInterval(_UILoadCheckIntervalID); + } } } }