<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
	horizontalAlign="left"
	backgroundSize="100%"
	creationComplete="appInitialize();" 
	xmlns="*" xmlns:ns2="commonLibrary.sharedComponent.*"
	height="100%"
	width="100%"
	resize="true"
	layout="absolute">

	<mx:Script>
		<![CDATA[
			import mx.containers.Panel;
			import mx.managers.PopUpManager;
			import flash.utils.getDefinitionByName;
			import cls.com.ils.biz.component.GsTextGetCanvas;
			import bizLibrary.sharedComponent.GcPanel;

			//一覧情報
			[Bindable]
			private var dataModel:XML;

		
			//設定XMLの読込み
			private function appInitialize():void{
	            //外部設定ファイルの読込
	            var loader:URLLoader = new URLLoader();
				loader.addEventListener("complete", runPg);
	
	            var request:URLRequest = new URLRequest("main.xml");
	            try {
	                loader.load(request);
	            } catch (error:Error) {
	                trace("Unable to load requested document.");
	            }					
			}
			
												
			//対象プログラムの起動
			private function runPg(event:Event):void
			{
	            var loader:URLLoader = URLLoader(event.target);
				//取込んだＸＭＬの内容のセット
			    dataModel = XML(loader.data);
			    
			    //呼び出すクラスをセット
			    var dspObj:Class = Class(getDefinitionByName(dataModel.data.runPg));
			    
			    //背景色の設定
			    if(dataModel.data.setColor.toString()!=""){
			    	appBox.setStyle("backgroundColor",dataModel.data.setColor.toString());	
			    }
			    
			    
			    //プログラムの呼出
			    if (dspObj != null) {
					var win:GcPanel;
					
					if(dataModel.data.errMsg.toString()==""){
						win =GcPanel(PopUpManager.createPopUp(this,dspObj,true));					
						win.focusManager.activate();
						this.focusManager.deactivate();
						win.xmlFileName = dataModel.data.xmlFileName;
						win.graphType = dataModel.data.graphType;
						win.graphForm = dataModel.data.graphForm;
						PopUpManager.centerPopUp(win);	
						
					}else{
						lblerrMsg.visible = true;
						lblerrMsg.text = dataModel.data.errMsg.toString();
					}

			    }
			    
			}
			
		]]>
	</mx:Script>

	<mx:VBox id="appBox" verticalAlign="middle" horizontalAlign="center" height="100%" width="100%" y="0">
		<mx:Label id="lblerrMsg" visible="true"  text="" fontSize="22" fontWeight="bold" color="#FF0000"/>	
	</mx:VBox>
	
</mx:Application>
