Robert,

Try this: overwrite the set data function to sort of force refresh the
value of this.data (and super.data).

Something like this:

public override function set data(value:Object):void
{
    super.data = value;
    
    if(value == null)
    {
        return;
    }
}


You can do a lot of cleansing in this setter, but the above addresses
the basic need of keeping this.data fresh.


Hope that winds up the problem for you.


Ross

--- In flexcoders@yahoogroups.com, Robert Byrne <[EMAIL PROTECTED]> wrote:
>
> Ross, when I saw your idea I went straight to it thinking this might
be it!  But it wasn't.  Infact, this.listData.label was the old
information.  But when entering the renderData function, it is the new
value.  This only serves to confuse me even more.  It's like the
binding never happened.
>  
> I tried both of these:
>  
> BindingUtils.bindProperty(this.creativeLinkButton, "label", this,
["listData", "label"]);
> BindingUtils.bindProperty(this.creativeLinkButton, "label",
this.listData, ["label"]);
> -
> Sorry bout the colors and font, pasted from eclipse.
>  
> Also, I looked into this.data.  I set a break in my code and
mx.core.Container to see not only the value passed into the set data
function but to see when things are kicking off.  Well, the data is
not being set until after my code runs.  The correct information is
passed into the setter, but not at the right time.
>  
> Perhaps I can use the data change event that is dispatched to update
my values.  Any other ideas?
>  
> Thanks,
> -Robert
>  
> --- On Tue, 12/2/08, ross_w_henderson <[EMAIL PROTECTED]> wrote:
> 
> From: ross_w_henderson <[EMAIL PROTECTED]>
> Subject: [flexcoders] Re: ItemRenderer, mislabels & scrolling
> To: flexcoders@yahoogroups.com
> Date: Tuesday, December 2, 2008, 3:19 PM
> 
> I've had similar issues.  
> 
> One of the things I've found is that it is important to reduce the
> steps between this.data, or this.listData, and the property you're
> populating. 
> 
> If you can rewrite so that you bind directly on this.listData.label,
> rather than set the value of 'value' and bind on 'value', I
> think
> you'll probably be okay.
> 
> 
> Alex - if you wrote a book on item renderers, I would buy it.  Just so
> you know there's a market.
> 
> 
> Ross
> 
> 
> 
> 
> --- In flexcoders@yahoogroups.com, Alex Harui <aharui@> wrote:
> >
> > itemRenderer.data should always be the data for the row.  It should
> never be the old data unless you overrode the setter.
> > 
> > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of Robert
> > Sent: Monday, December 01, 2008 3:58 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] ItemRenderer, mislabels & scrolling
> > 
> > 
> > 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"]);
> > }
> >
> 
> 
> 
> ------------------------------------
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
>
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
> Groups Links
>


Reply via email to