7 Replies Latest reply on Apr 27, 2010 10:25 AM by philippe.sabourin

    Module in separate Projects issue


      I tried setting up a Module in a separate project from my main application following the instructions of a couple threads and keep getting these errors when i load the module. I've tried a few different fixes that i found on the web (like load externs and such) but haven't been able to resolve them. Does anyone have a good guide i could follow to setup my workspace? Or a set of example projects.



      I get the following errors:

      Error: Could not find compiled resource bundle 'SharedResources' for locale 'en_US'.
          at mx.resources::ResourceManagerImpl/installCompiledResourceBundle()[E:\dev\4.0.0\frameworks \projects\framework\src\mx\resources\ResourceManagerImpl.as:340]
          at mx.resources::ResourceManagerImpl/installCompiledResourceBundles()[E:\dev\4.0.0\framework s\projects\framework\src\mx\resources\ResourceManagerImpl.as:269]
          at mx.core::FlexModuleFactory/installCompiledResourceBundles()[E:\dev\4.0.0\frameworks\proje cts\framework\src\mx\core\FlexModuleFactory.as:610]
          at mx.core::FlexModuleFactory/docFrameHandler()[E:\dev\4.0.0\frameworks\projects\framework\s rc\mx\core\FlexModuleFactory.as:580]
          at mx.core::FlexModuleFactory/docFrameListener()[E:\dev\4.0.0\frameworks\projects\framework\ src\mx\core\FlexModuleFactory.as:126]

      Followed by:

      TypeError: Error #1007: Instantiation attempted on a non-constructor.
          at mx.controls::ProgressBar/createChildren()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\controls\ProgressBar.as:1110]
          at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\ UIComponent.as:7250]
          at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\ framework\src\mx\core\UIComponent.as:7142]
          at mx.core::UIComponent/addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\ UIComponent.as:6848]
          at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.0.0\frameworks\projects\ spark\src\spark\components\Group.as:1825]
          at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.0.0\frameworks\project s\spark\src\spark\components\Group.as:1416]
          at spark.components::Group/setMXMLContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark \components\Group.as:512]
          at spark.components::Group/createChildren()[E:\dev\4.0.0\frameworks\projects\spark\src\spark \components\Group.as:734]
          at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\ UIComponent.as:7250]
          at components.conn::ConnectionDialog/initialize()

      Followed by:

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at mx.controls::ProgressBar/measure()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\cont rols\ProgressBar.as:1293]
          at mx.core::UIComponent/measureSizes()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\cor e\UIComponent.as:8042]
          at mx.core::UIComponent/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\cor e\UIComponent.as:7966]
          at mx.managers::LayoutManager/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\managers\LayoutManager.as:617]
          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:733]
          at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1072]

        • 1. Re: Module in separate Projects issue
          David_F57 Level 5



          have you tried compiling you swfs with the compiler option set to merge into code ?



          • 2. Re: Module in separate Projects issue
            philippe.sabourin Level 1

            I think that would defeat the purpose of modules since you don't want your application to load up with all the modules already compiled in. Unless i'm misunderstanding?

            • 3. Re: Module in separate Projects issue
              philippe.sabourin Level 1

              I decided to try and put them in the same project, and now only the second/third error show up. If i add a mx.controls.ProgressBar to my main application however this doesn't happen, but it errors on PopupManagerImpl. Do i need to add imports for every class i use in modules in my main application?  That seems tedious. Is there another way to fix this?

              • 4. Re: Module in separate Projects issue
                philippe.sabourin Level 1

                Is using modules in Flash Builder 4/flex 4 even recommended? There aren't many resources online about it. Spent a lot of time trying to figure out how to make the module load but still getting those errors about classes not being instantiated.

                • 5. Re: Module in separate Projects issue
                  Mrs Dafna

                  Hi Philippe!

                  We have encountered a problem which i think is similar  - we were using spark components in the module, and if they weren't defined in the main app it couldn't find there default skin.

                  By adding the flag -keep-all-type-selectors to the compiler of the main app we were able to solve this problem in some of our apps.

                  (got it from this link: http://forums.adobe.com/message/2208483#2208483)


                  But we STILL have an ERROR that it cannot find default skin of spark components in a module which is called by a module called by the main app.

                  the flag -keep-all-type-selectors doesn't work in this case.


                  Anyone having other ideas ??

                  • 6. Re: Module in separate Projects issue
                    Flex harUI Adobe Employee

                    There isn't new doc, because the workflow didn't change.  It works pretty

                    much the same as Flex3.  There is no s:Module or s:ModuleLoader so you

                    continue to use the mx versions as you did before.


                    The styles mechanism did change so that each module has its own styles and

                    now is sensitive to a common mistake in setting up modules projects.  Folks

                    accidentally reference the module class directly from within the main

                    application instead of using a shared interface.  Doing so actually links in

                    the module and its dependencies into the main app, defeating the main point

                    of modules, but in Flex 4, that configuration also throws errors.


                    Another change in Flex 4 is that the main app must load singletons shared by

                    modules.  That is the result of optimizing startup a bit by not linking in

                    every manager you might possibly need.   This means that if your app doesn't

                    use popups and your modules do, you must link the PopUpManager into the mai

                    app by doing:


                    Import mx.managers.PopUpManager; PopUpManager;


                    It is also possible that there is a bug.  Simplify your scenario and file a

                    bug or post the test case if the simple case also fails.  Maybe you've got

                    some other configuration we didn't anticipate.

                    • 7. Re: Module in separate Projects issue
                      philippe.sabourin Level 1

                      Thanks, adding the -keep-all-type-selectors  to the compiler of the main app worked.