When scrolling, the labels on the grid turn into those that the 
recycled item renderer used.  I tried using this.data to overwrite 
the values every time.  The new listData object has the correct 
label and so I thought it was working, but there is a url I need in 
the current rows' XML for the button click to work and accessing the 
this.data gave me the old results.  I then thought I could use the 
row index in listData but quickly found that the row index is always 
the same when scrolling down or up, the end or the begining of the 
grid.  So it's not really the row index of the XML but the grid.  
Seems overwritting the values wasn't quite the answer.

There is a variable in listData called item.  I see it in the 
debugger but the compiler won't let me access it.  This is the XML 
for the row.  So, in short, how can I access this 'listData.item' or 
find out the actual XML row I am on.  Actually, any suggestion would 
be great.  Banging my head on this one all day.

And thanks.

Here's some code:

public function get listData():BaseListData{
  return _listData;
}

public function set listData(blData:BaseListData):void{
  _listData = DataGridListData(blData);
  renderData();
}   

private function renderData():void {
  var columnIndex:int;  
  var xmlRow:XML;
                        
  columnIndex = this.listData.columnIndex;
  xmlRow = XML(this.data);
/*
 * I added this to get at the item.
  try{
    if(this.listData.item != null){
      xmlRow = XML(this.listData.item);
    }
    else{
      xmlRow = XML(this.data);
    }
  }
  catch(e:Error){
    xmlRow = XML(this.data);
  }
*/

  this.value = this.listData.label;
  if ( value == "[multiple]" ){
    this.creativeLinkButton.enabled = false;
    this.creativeLinkButton.useHandCursor = false;
    this.creativeLinkButton.setStyle("textDecoration", "none");
  }
  else{
    this.creativeLinkButton.enabled = true;
    this.creativeLinkButton.useHandCursor = true;
    this.creativeLinkButton.setStyle("textDecoration", "underline");
  }

  // get toolTip = @u(columnIndex)
  // get url = @u(columnIndex)
  var urlName:String = "@u" + columnIndex.toString();
  this.url = xmlRow[urlName];
  this.description = xmlRow[urlName];
}

override protected function setMXMLViewBindings():void{
  super.setMXMLViewBindings();
  this.logger.debug("setMXMLViewBindings");

  // Set creativeLink link button's label
  BindingUtils.bindProperty(this.creativeLinkButton, "label", this, 
["value"]);

  // Set creativeLink link button's toolTip
  BindingUtils.bindProperty(this.creativeLinkButton, "toolTip", 
this, ["description"]);
}


Reply via email to