5 Replies Latest reply on May 29, 2009 7:44 PM by Michael Borbor

    Glabel function does not work.

    jogla

      I'm currently trying to implement a global function like "trace" to improve the convenience of localizing strings.

       

      Here's an example:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
          <mx:Script>
              <![CDATA[
                  public function foo():void {
                      localize("bar");
                  }
              ]]>
          </mx:Script>
      </mx:Application>

       

      as main application, and:

       

      package {
          public static function localize(key:String):void {
              resourceManager.getString('FooMain', key);
          }
      }

       


      directly in the source folder.

       

      Although localize is correctly recognized by the flex builder auto completion feature, the compiler (sdk 3 and sdk3.3) complains not to find it.

      1180: Call to possibly undefined method localize.

       

      What am I doing wrong?

       

      I appreciate any answers.

      Jonathan