在init()方法中,一直在initModuleProgress()方法中加载,就是无法跳到initModuleReady()方法中,这是为什么?
这是main.mxml
- XML code
<?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="100%" height="100%" xmlns:ns3="modules.*" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.rpc.events.FaultEvent; import mx.controls.Alert; import mx.modules.IModuleInfo; import mx.events.ModuleEvent; import mx.modules.ModuleLoader; import mx.modules.ModuleManager; private function init():void { initUserManagerModuleLoader.url = "modules/UserManager.swf"; contentViewStack.percentWidth = 100; contentViewStack.percentHeight = 100; contentViewStack.selectedChild = initUserManagerModuleLoader; initUserManagerModuleLoader.addEventListener(ModuleEvent.ERROR, initModuleError); initUserManagerModuleLoader.addEventListener(ModuleEvent.READY, initModuleReady); initUserManagerModuleLoader.addEventListener(ModuleEvent.PROGRESS, initModuleProgress); } private function initModuleError(event:FaultEvent):void { Alert.show(event.message + ""); } private function initModuleReady(moduleEvent:ModuleEvent):void { Alert.show("initModuleReady"); } private function initModuleProgress(moduleEvent:ModuleEvent):void { Alert.show("initModuleProgress"); } ]]> </mx:Script> <mx:HBox width="100%" height="100%" horizontalGap="0"> <mx:Panel width="15%" height="100%" layout="absolute" textAlign="center"> <mx:Accordion headerStyleName="accordion" width="100%" height="100%"> <mx:Canvas label="系统管理" width="100%" height="100%"> </mx:Canvas> </mx:Accordion> </mx:Panel> <mx:ViewStack id="contentViewStack"> <mx:ModuleLoader id="initUserManagerModuleLoader" width="85%" height="100%"/> <mx:ModuleLoader id="registerUserModuleLoader" width="85%" height="100%"/> </mx:ViewStack> </mx:HBox> </mx:Module>
这是UserManager.mxml
- XML code
<?xml version="1.0" encoding="utf-8"?> <mx:ModuleLoader xmlns:mx="http://www.adobe.com/2006/mxml" width="589" height="483"> <mx:Panel width="100%" height="100%" layout="absolute" title="123123" fontSize="12"> <mx:Button x="498" y="286" label="Button"/> <mx:ComboBox x="231" y="425"></mx:ComboBox> <mx:AdvancedDataGrid x="489" y="318" id="adg1" designViewDataType="tree"> <mx:columns> <mx:AdvancedDataGridColumn headerText="Column 1" dataField="col1"/> <mx:AdvancedDataGridColumn headerText="Column 2" dataField="col2"/> <mx:AdvancedDataGridColumn headerText="Column 3" dataField="col3"/> </mx:columns> </mx:AdvancedDataGrid> </mx:Panel> </mx:ModuleLoader>