4 Replies Latest reply on Feb 3, 2010 12:55 PM by edwinmerced

    Module and Component

    edwinmerced Level 1

      Can someone please lead to some information on the similarities and diferecnes between Componets and Modules in Flex? Thank you.

        • 1. Re: Module and Component
          Gregory Lafrance Level 6

          Components and modules are similar, but in general, think of components as the building blocks for pieces of UI in your app, and think of modules as larger pieces of your application that the user might not even need at any one time.

           

          So if you have an insurance company app with 1000 screens, and the typical user may only need 10 of the screens, use modules and load as necessary, so you don't have a 2GB SWF.

           

          http://livedocs.adobe.com/flex/3/html/help.html?content=modular_2.html

           

          http://livedocs.adobe.com/flex/3/html/help.html?content=modular_3.html

           

          http://livedocs.adobe.com/flex/3/html/help.html?content=Part4_CreateComps_1.html

           

          If this post answers your question or helps, please mark it as such.


          Greg Lafrance - Flex 2 and 3 ACE certified

          www.ChikaraDev.com

          Flex / AIR Development, Training, and Support Services

          1 person found this helpful
          • 2. Re: Module and Component
            edwinmerced Level 1

            Thanks Greg fro you enlightening answer.

             

            But are all components and modules loaded at the initialization of an application? Or are they eqaully loaded as the user requests each piece?

             

            Att.,

             

            Edwin

            • 3. Re: Module and Component
              Gregory Lafrance Level 6

              Components are created when you create an instance of the component. So if you create the instance of a component using an MXML tag, it is created at app startup, unless the component is in a ViewStack (or other navigation container) view and it is not in the first view (unless creationPolicy is set to all, then all ViewStack views controls are created when the ViewStack is created).

               

              If you create the component in ActionScript, then the component is created when you call the "new" operator, like:

               

              var myComp:MyFancyComp = new MyFancyComp();

               

              but though it may be instantiated it won't display until you use addChild(myComp) to add it to a container (or to the main app).

               

              Controls in modules will not be instantiated or displayed until you "load" the module.

               

              The links in my previous entry will clear this all up.

               

              If this post answers your question or helps, please mark it as such.


              Greg Lafrance - Flex 2 and 3 ACE certified

              www.ChikaraDev.com

              Flex / AIR Development, Training, and Support Services

              • 4. Re: Module and Component
                edwinmerced Level 1

                Thanks Greg:

                 

                You have cleared my notion on the subject and have provided valuable resources (through which I read for extra clarification).

                 

                It would seem that large applications demand the Modules approach (for segmentation) whereas smaller apps could use Components ( for fragmentation) I understand there are 2 methods to create Modules and Compoennts(via MXML or AS3) so I guess the developers skills would also determine which approach to favor as well.

                 

                Your replies and contributions have been very helpfull. Thank you.

                 

                Att.,

                 

                Edwin