1 Reply Latest reply on Sep 17, 2007 2:22 PM by Newsgroup_User

    how to reference item renderer image

    P Steven Level 1
      I am creating a datgrid that contains an item renderer. The item renderer is a mxml component containing just one embedded swf

      I can't figure out how to set the symbol of this image from the code where I dynamically create the datagrid.

      Here is my code for my custom component

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="100" height="30">


      <mx:Script>
      <![CDATA[


      [Bindable]
      [Embed('assets/icons.swf', symbol='incomplete')]
      public var incomplete:Class;

      [Bindable]
      [Embed('assets/icons.swf', symbol='awaitingSubmission')]
      public var awaitingSubmission:Class;

      [Bindable]
      [Embed('assets/icons.swf', symbol='submitted')]
      public var submitted:Class;

      public function set imagePath(value:String):void {

      statusIcon3.source=this[value];

      }

      ]]>
      </mx:Script>

      <mx:SWFLoader id="statusIcon3" x="5" y="6"/>

      </mx:Canvas>


      And here is the relevant code for creating the datagrid column

      dgc = new DataGridColumn();

      dgc.headerText = xmlColumn.localName();
      dgc.itemRenderer=new ClassFactory(statusComponent);
      dgc.dataField = xmlColumn.localName();

      Somehow I need to set the value of imagePath when I am creating the datagrid column

      Any ideas?

        • 1. Re: how to reference item renderer image
          Level 7
          Check this sample.
          http://www.adobe.com/devnet/flex/quickstart/using_item_renderers/

          Rgds
          JFB

          "ChuckyLeFrek" <webforumsuser@macromedia.com> wrote in message
          news:fcmc2f$qn6$1@forums.macromedia.com...
          >I am creating a datgrid that contains an item renderer. The item renderer
          >is a
          > mxml component containing just one embedded swf
          >
          > I can't figure out how to set the symbol of this image from the code where
          > I
          > dynamically create the datagrid.
          >
          > Here is my code for my custom component
          >
          > <?xml version="1.0" encoding="utf-8"?>
          > <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="100"
          > height="30">
          >
          >
          > <mx:Script>
          > <![CDATA[
          > [Bindable]
          > public var studentName:String ="Student Name";
          >
          >
          > [Bindable]
          > [Embed('assets/icons.swf', symbol='incomplete')]
          > public var incomplete:Class;
          >
          > [Bindable]
          > [Embed('assets/icons.swf', symbol='awaitingSubmission')]
          > public var awaitingSubmission:Class;
          >
          > [Bindable]
          > [Embed('assets/icons.swf', symbol='submitted')]
          > public var submitted:Class;
          >
          > public function set imagePath(value:String):void {
          >
          > statusIcon3.source=this[value];
          >
          > }
          >
          > ]]>
          > </mx:Script>
          >
          > <mx:SWFLoader id="statusIcon3" x="5" y="6"/>
          >
          > </mx:Canvas>
          >
          >
          > And here is the relevant code for creating the datagrid column
          >
          > dgc = new DataGridColumn();
          >
          > dgc.headerText = xmlColumn.localName();
          > dgc.itemRenderer=new ClassFactory(statusComponent);
          > dgc.dataField = xmlColumn.localName();
          >
          > Somehow I need to set the value of imagePath when I am creating the
          > datagrid
          > column
          >
          > Any ideas?
          >
          >
          >