Well here's my code from mapmanager.mxml.
//config
private function config(event:AppEvent):void
{
configData = event.data as ConfigData;
}
//init
private function init():void
{
SiteContainer.addEventListener(AppEvent.CONFIG_LOADED, config);
//sean's mod
var LoginInstance:LoginMainApp=new LoginMainApp(this.width,this.height,TokenUrl,ClientId,MapLayerLocation,RestLogin,ExpirationToken);
LoginInstance.addEventListener(Event.COMPLETE, SecurityInit);
//apparently PopUpManager can only be called through flex. =(
PopUpManager.addPopUp(LoginInstance.LoginPop,this,true);
PopUpManager.centerPopUp(LoginInstance.LoginPop);
//LoginInstance.SetLoginPositions();
//Alert.show("Starting");
//sean's mod
}
Where LoginInstance is my custom actionscript login file that i wrote. Once it completes verification with the rest service, it returns a custom event Event.COMPLETE back to SecurityInit.
Here is SecurityInit()
private function SecurityInit(e:Event):void
{
//sean try mod
Alert.show("Starting");
SiteContainer.addEventListener(AppEvent.SET_MAP_NAVIGATION, changeNavigationbyMenu);
SiteContainer.addEventListener(AppEvent.BASEMAP_MENU_CLICKED, basemapMenuClicked);
//SiteContainer.addEventListener(AppEvent.SET_MAP_NAVIGATION, changeNavigationbyWidget);
SiteContainer.addEventListener(AppEvent.SET_MAP_ACTION, enableMapAction);
SiteContainer.addEventListener(AppEvent.SHOW_INFOWINDOW, widgetShowInfo);
//sean try mod
map = new Map();
map.id = "map";
map.zoomSliderVisible = false;
map.addEventListener(MapEvent.LOAD, mapLoadComplete);
this.addChild(map);
SiteContainer.dispatchEvent(new AppEvent(AppEvent.MAP_LOADED, false, false, map));
and so on.....
The key changes for this code are the SiteContainer.addEventListener. They must be taken FROM the original init, and placed to fire AFTER verification has been done successfully.
Let me know if you need more code. ^_^