8 Replies Latest reply on Apr 15, 2009 11:06 AM by jknox16

    Loading multiple modules fails - only last one loaded works

      test

        • 1. Re: Loading multiple modules fails - only last one loaded works
          Level 1

          Wow, I can't get this to post correctly. Trying to post zip file.

          • 2. Re: Loading multiple modules fails - only last one loaded works
            Level 1

            Wow, I really don't like this forum design.

             

            Anyway, I'm trying to load some modules and I did a test app to illustrate. Since I can't seem to post code here I'll try to describe it.

             

            A simple application loads 3 modules. Each module has a button that executes a function in the parent application and gets a response. Only the last module to load functions. I have attached the MXML files as txt files so that they would upload. It only let me upload 3 but module3.mxml is identical to the other two so it should be obvious what is intended.

             

            Sorry for the poor message structure. These forums don't want to cooperate with me.

             

            Thanks,

             

            Jeff

            • 3. Re: Loading multiple modules fails - only last one loaded works
              florian_h

              Sorry for the poor message structure. These forums don't want to cooperate with me.

              I absolutely know what you're talking about ... have rly much problems posting new threads (mainly in Opera, but also in firefox).

               

              Also, I get an eMail for every new post in this forum, as I accidentally clicked on "Receive email notifications" and was unable to stop it till now (the link finally worked and didn't just throw me to the forum index).

               

               

              Sorry for off topic, but the new forum really has room for improvement...

              • 4. Re: Loading multiple modules fails - only last one loaded works
                run,ryan! Level 3
                as I accidentally clicked on "Receive email notifications" and was unable to stop it till now

                same here

                • 5. Re: Loading multiple modules fails - only last one loaded works
                  Flex harUI Adobe Employee

                  A common reason is that the IModuleInfo from getModule is not kept in an instance variable.  If it is only referenced by a local variable it can get garbagecollected and the creating of the modules factory class can cause that GC

                   

                  Alex Harui

                  Flex SDK Developer

                  Adobe Systems Inc.

                  Blog: http://blogs.adobe.com/aharui

                  • 6. Re: Loading multiple modules fails - only last one loaded works
                    Level 1

                    Interesting. On the actual project I know that everything is local. However, can you explain why my test app is not functioning? In the test app the modules are being loaded with                                                                                                              [/code] Each module simply calls the getData function when a button is pressed. Only module3 works in this instance. The info on the instance variable is good to know, but I suspect that we might also be running into some domain/security issues. We have found a lot of hints in our searches but so far no definite solutions. Sorry for the mess in posting above. (I hope this one is better.) Not only was I under the gun to get a demo functioning but I was also running on a lack of sleep. On a positive note the demo went very well and now I have to figure out what went wrong with the modules. Thanks for the response, Jeff

                    • 7. Re: Loading multiple modules fails - only last one loaded works
                      Level 1

                      Still can't get these forums to post correctly.

                       

                      I'll try again...

                      • 8. Re: Loading multiple modules fails - only last one loaded works
                        Level 1

                        Interesting. On the actual project I know that everything is local. However, can you explain why my test app is not functioning? In the test app the modules are being loaded with <mx:ModuleLoader rather than in action script. Is there something I'm missing here in defining an inistance variable for them?

                         

                        <?xml version="1.0" encoding="utf-8"?>
                        <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
                                <mx:Script>
                                <![CDATA[
                               
                                public function getData(something:String):String {
                                    return ("The module said: " + something);
                                }


                                public function getMoreData(something:String):String {
                                    return ("getMoreData: " + something);
                                }


                                ]]>
                            </mx:Script>
                           
                                <mx:HBox width="100%" id="top">
                                    <mx:ModuleLoader url="module1.swf"/>
                                </mx:HBox>
                                <mx:HBox width="100%" id="middle">
                                    <mx:ModuleLoader url="module2.swf"/>
                                </mx:HBox>
                                <mx:HBox width="100%" id="bottom">
                                    <mx:ModuleLoader url="module3.swf"/>
                                </mx:HBox>


                        </mx:Application>

                         


                        Each module simply calls the getData function when a button is pressed. Only module3 works in this instance.


                        The info on the instance variable is good to know, but I suspect that we might also be running into some domain/security issues. We have found a lot of hints in our searches but so far no definite solutions.


                        Sorry for the mess in posting above. (I hope this one is better.) Not only was I under the gun to get a demo functioning but I was also running on a lack of sleep. On a positive note the demo went very well and now I have to figure out what went wrong with the modules.


                        Thanks for the response,

                        Jeff