0 Replies Latest reply on Jul 31, 2009 2:56 PM by 80sRelic

    Module and Parent App Communication




      First please bear with me as I am new to Flash Builder, ActionScript etc.


      I have a small project that might benefit from using modules. I played around with it a little and ran into an issue that I can't get my head around.


      I have a simple module that has a datagrid that is populated with data from a PHP data source. It takes a parameter from the parent application when the module is created, does the query using the parameter and then populates the datagrid. My problem is that the datagrid never gets poplulated when the function that does the query (inside the module) is called from the parent application. But when I test the function from inside the module all is fine. I know the function is being called from the parent app ok by placing an Alert in to test it. Any help is appreciated. Here is the relavent code from the parent application and module:


      Parent App:


                     // This function loads the module

                   public function initApp():void {       
                       // Get the IModuleInfo interface for the specified URL.
                       assetModule = ModuleManager.getModule("SimPanel_1.swf");   
                       assetModule.addEventListener("ready", getModuleInstance);
                   public function getModuleInstance(e:Event):void {
                       // Get an instance of the module.
                       sm = assetModule.factory.create() as SimPanel_1;


                        //this is the call to the function in the module that does the query

                       //displays the module in a vbox of the parent app
                       vb1.addChild(assetModule.factory.create() as DisplayObject);






                     //This is the function that does the query

                     public function computeAnswer(simID:int):void {
                          getSimDetailResult.token = testservice1.getSimDetail(simID);



                     //This is the datagrid in the module

                     <mx:DataGrid id="dataGrid" dataProvider = "{getSimDetailResult.lastResult}">
                          <mx:DataGridColumn headerText="session" dataField="session"/>
                         <mx:DataGridColumn headerText="status" dataField="status"/>
                         <mx:DataGridColumn headerText="course" dataField="course"/>
                        <mx:DataGridColumn headerText="id" dataField="id"/>