7 Replies Latest reply on May 30, 2008 12:15 AM by elixir_adeel

    Flex 3 (final) and IResourceManager

    mokkel08
      Hello,

      I've upgraded to the final version of Flex 3, but it gives me the following error:

      quote:

      Error: No class registered for interface 'mx.resources::IResourceManager'.
      at mx.core::Singleton$/getInstance()[C:\Programmer\Adobe\Flex 3 SDK\frameworks\projects\haloclassic\mx\core\Singleton.as:111]
      at mx.resources::ResourceManager$/getInstance()[C:\Programmer\Adobe\Flex 3 SDK\frameworks\projects\haloclassic\mx\resources\ResourceManager.as:83]
      at mx.collections::ListCollectionView()[C:\Programmer\Adobe\Flex 3 SDK\frameworks\projects\haloclassic\mx\collections\ListCollectionView.as:127]
      at mx.collections::ArrayCollection()[C:\Programmer\Adobe\Flex 3 SDK\frameworks\projects\haloclassic\mx\collections\ArrayCollection.as:78]
      at Untitled_fla::MainTimeline/frame1()[Untitled_fla.MainTimeline::frame1:3]


      The above is just an example. I have a large project which gives the same error when using mx.rpc.soap.WebService.

      Any suggestions?

      Thanks!
        • 1. Re: Flex 3 (final) and IResourceManager
          mokkel08 Level 1
          Doesn't anyone else experience this problem? It's happening for me on two machines - both Windows XP.
          • 2. Re: Flex 3 (final) and IResourceManager
            RobButera
            I am also experiencing the problem, however I get the stacktrace when I instantiate the ArrayCollection class. This problem seams to be related to a backwards compatibility issue with Flex 3 which requires the ResourceManager to be initialised for some classes. This is no problem if you have a main mxml file which seams to take care of all of the initialisation for you, however if you have a straight actionscript project you don't get any of this for free, which is my situation (and I assume yours mokkel08??). The following bug is of relevance: https://bugs.adobe.com/jira/browse/SDK-12205
            I have tried every which way to get the ResourceManager initialised, but so far have not had any luck.
            If anybody can provide any guidance here it would be very much appreciated.
            Rob
            • 3. Re: Flex 3 (final) and IResourceManager
              mseritan
              This is an issue for me too. I am trying to instantiate an automatic class created by embedding an image, I am using my own main class.
              • 4. Re: Flex 3 (final) and IResourceManager
                mseritan Level 1
                Hei guys,

                Got lucky here :) My Main class used to inherit from Sprite. I changed it to inherit from UIComponent and then added it to the <mx:application>.

                <?xml version="1.0" encoding="utf-8"?>
                <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:decode="com.decodeideas.*">
                <decode:Main>

                </decode:Main>

                </mx:Application>

                Also in the constructor you cannot access the stage or any other graphical method. I moved the code from the constructor to a setup method

                public function Main() {
                addEventListener(Event.ADDED_TO_STAGE, setup);
                }

                This seems to work to bring up the flash app, I will post some more if I get in problems.
                • 5. Re: Flex 3 (final) and IResourceManager
                  RobJellinghaus
                  Use the source, Luke!

                  I stepped down into the source of ResourceManager.getInstance, and saw that it was related to Singleton.getInstance, which retrieved values stored by Singleton.registerClass, which was called mainly by FlexModuleFactory.docFrameHandler ("find in files" is your friend!). A bit of code snipping and I now recommend this:

                  1) Ensure that your code does no initialization of Log objects before the main application's constructor runs.

                  2) Put the following at the top of your main application's constructor:

                  // Do what FlexModuleFactory does, only by hand.
                  var resourceManagerImpl:Object =
                  flash.system.ApplicationDomain.currentDomain.getDefinition("mx.resources::ResourceManagerI mpl");
                  mx.core.Singleton.registerClass("mx.resources::IResourceManager", Class(resourceManagerImpl));

                  3) Ensure that all initialization of ResourceManager-dependent classes (e.g. ArrayCollection, Logger) happens after the above code has run.

                  I am not sure if this is the best solution, only that it works for me :-)
                  Cheers!
                  Rob
                  • 6. Re: Flex 3 (final) and IResourceManager
                    mokkel08 Level 1
                    Your workaround worked perfectly for me - thanks!

                    And thanks for your reply on FlashDevelop.org!
                    • 7. Re: Flex 3 (final) and IResourceManager
                      elixir_adeel
                      please tell me how to use resourceManager in an actionscript file
                      thank you