2 Replies Latest reply on Dec 13, 2010 10:56 AM by Flex harUI

    Image item renderer issue

    jfb00 Level 3

      Hi all,

      Yesterday I found a soultion to display my image in my datagrid column. Now the issue is that if i leave the screen and come back to my screen the images move one space like the row index is adding one count, it's not validating my if statement.

      Any ideas?

      Thanks

       

      Johnny

      <mx:DataGridColumn headerText="LOCK" dataField="ISLOCKED" width="40">
          <mx:itemRenderer>
              <mx:Component>
                  <mx:HBox horizontalAlign="center">
                  <mx:Script>
                      <![CDATA[
                          import mx.core.BitmapAsset;
                          
                          [Embed(source="assets/images/lock.png")]
                          [Bindable]
                          public var lockImage:Class;
                          
                          private function checkLocked():void{
                              if (data.ISLOCKED == 1){
                                  var asset:BitmapAsset = new lockImage() as BitmapAsset;
                                  img.source = asset;
                                  addChild(img);
                              }else{
                                  img.source = "";
                                  addChild(img);
                              }
                          }
                      ]]>
                  </mx:Script>
                  <mx:Image id="img" creationComplete="checkLocked()" />
                  </mx:HBox>
              </mx:Component>
          </mx:itemRenderer>
      </mx:DataGridColumn>