1 Reply Latest reply on Apr 29, 2009 8:31 PM by Madhav Subedi

    Problem with resourceManager.getString()

    tersus

      Hey all,

       

      Having a problem with the resourceManager.getString() fxn -- the calls are unexpectedly returning null.

       

      I am loading an external resource module at runtime. It loads successfully. I do several resourceManager.getString('myResourceBundle', 'myKey') calls from w/in my MXML code and these all work. Like:

       

      <mx:Button label="{resourceManager.getString( ...)}" />

       

      That is fine.

       

      However, when I try to do calls to resourceManager.getString() from w/in my <mx:Script> </mx:Script> tags, the calls return null. There is also only a null locale associated with the resourceManager even though this was set earlier to en_US.

       

      Any ideas on what to do? Thanks.

        • 1. Re: Problem with resourceManager.getString()
          Madhav Subedi Level 4

          make sure that your resource manager has loaded before fetching a string .

           

          .

          .

          .

          .


          var eventDispatcher:IEventDispatcher = resourceManager.loadResourceModule( resourceModuleURL );

          eventDispatcher.addEventListener( ResourceEvent.COMPLETE, completeHandler );

          .

          .

          .

          }





           

          private function completeHandler(event:ResourceEvent):void

          {

              resourceManager.localeChain = ["en_US"];


             var mystring:String = resourceManager.getString('myResources', 'mystring');

          }

           

          hope it helps.