6 Replies Latest reply on Oct 13, 2011 10:47 AM by kingquattro

    Module Interface error

    kingquattro Level 1

      Hey guys,

           I am having trouble passing data between main app and module created in different project.  In my Flash Builder I have two projects 1. main app and 2. a login module.  I have an interface in login module that I want to use to communicate between module and app. 

       

           My question is it even possible?  Any example I found so far have modules and app in the same FB project, so main app can just import inteface using

            [code] import com.module.interface.InterfaceName[/code]

       

          But in my case I can't use the statement above.  How can I communicate using inteface between app and module or module and module when each are their individual projects.  I want to avoid any hard dependencies if possible.

       

          So far I have been following this example, is there another example that someone can point me too..

                http://docs.google.com/viewer?a=v&q=cache:FMjA68PSKZwJ:blogs.adobe.com/flexdoc/files/flexd oc/pdfs/modular.pdf+modular+flex+application&hl=en&gl=us&pid=bl&srcid=ADGEEShh7Ah6t9s0YKAF zcjrGxSXKH94w8dKBBZmpJUOjIcblgzUZj3WA0fcxU6-hkgXgshUZjLhG5vDZbYSBgRZ7PtRnKuHyZ58xG5Zz4Pfk_ RyynN8mbDoq-10AM0BxqVqlrccGwB4&sig=AHIEtbSqpF3ejhzd6P6VBqLgd6GTGXFVLg

       

          or

       

         blogs.adobe.com/flexdoc/files/flexdoc/pdfs/modular.pdf

       

       

      Jay

        • 1. Re: Module Interface error
          Flex harUI Adobe Employee

          Why can’t you use the import statement?  Point the source-path to the other project (or build a library project to do it “correctly”)

          • 2. Re: Module Interface error
            kingquattro Level 1

            Hi harUI, can walk me through how to build a library project?  I don't know what you are asking me to do here.

             

            Here is what I have in FB 4.5

               MainApp (project 1)

               Login (project 2)

                 I have configured this to produce output in /MainApp/assets/modules

                 No html is produced

             

            Is there anything else I need to do?

             

              In my MainApp I have

                  <mx:ModuleLoader id="loginMod" url="assets/modules/User.swf" ready="applyUserModSettings(event)"/>

             

            and applyUserModSettings looks as follows.

             

            private function applyUserModSettings(event:ModuleEvent):void{

                            var ichild:* = loginMod.child as IUserInterface;

                            if (loginMod.child != null){

                                ichild.setServiceEndPoint = _util.endpoint;

                            }

                        }

             

            Here IUserInterface is interface class in Login project com.modules.IModuleInterface

             

            Jay

            • 3. Re: Module Interface error
              Flex harUI Adobe Employee

              Create a Flex Library project.  Put the interface class in the source for that project.  Set Project References to that library project from the two other projects.

              1 person found this helpful
              • 4. Re: Module Interface error
                kingquattro Level 1

                Hey harUI,

                    This would mean that for every module I want to create I will have to create 2 projects.  Is this the only way, other than creating all modules under mainapp?

                • 5. Re: Module Interface error
                  Flex harUI Adobe Employee

                  I hope all of your modules have something in common, otherwise you are going to have to manage a ton of interfaces and you don’t have as good an abstraction boundary.  If you can define a few interfaces that all modules respond to, then all those interfaces would go in the shared library.

                  • 6. Re: Module Interface error
                    kingquattro Level 1

                    Hey harUI,

                       Yes that exactly what I though off later at night.  I can keep all my interfaces under one library and share that lib across all modules.  Thanks for you help on this.

                     

                    Jay