1 Reply Latest reply on May 26, 2008 10:37 PM by Gregory Lafrance

    Problems with itemRenderer

    cheftimo Level 2

      Here is an itemRenderer for a TileList, a simple custom component (not an inline renderer). I'm having problems accessing properties in the main application file.

      The code works fine, now what I need to do is get the value of 'locale', which is set in the main application where the tile list is used. So the first line of the code, I think should be
      private var locale:String = outerDocument.locale;

      'locale' is set as a public var in the main application.

      The compiler error is 'Access of undefined property outerDocument', but according to the Flex docs this should work. Just in case, I have also tried: Application.locale, Application.application.locale, parentDocument.locale and several other with no success.

      What else should I try?


        • 1. Re: Problems with itemRenderer
          Gregory Lafrance Level 6
          This seems to work:

          ------------- components.TestComp1.mxml ------------
          <?xml version="1.0" ?>
          <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml">
          <mx:Image id="image" width="60" height="60" source="{data.image + '_150.jpg'}"/>
          <mx:Text text="{setCaption()}"/>
          import mx.core.Application;
          private var locale:String = Application.application.locale;

          private function setCaption():String{
          if (locale == "en_US"){
          return "caption_en_US";
          return "caption_es_CO";
          ---------------- Test.mxml -----------------
          <?xml version="1.0"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
          public var locale:String = "en_US";

          public var xmlData:XML =
          <caption>Paris Caption</caption>
          <caption>Rome Caption</caption>
          <mx:HorizontalList id="myList"