OK, I have it working now. Thanks for the discussion - made me rethink
how CellRenderer works.  Some explaination:

>>What I'm trying to say is that the _parent class's_ implementation of
>>setValue() - i.e. the default one that would get called if 
>>you hadn't written your own - 

It actually still gets called.  Yes, I wrote my own, but this was based
on Macromedia's own examples.  Write a cellRenderer class for dataGrid
and you'll see your overridden function setValue gets called anyway.
It's a function that gets called everytime a rollover or change of any
kind occurs in the list component (datagrid). 

>>might do something that sets a 
>>value in the dataProvider.

Yes, thanks, that gave me a thought, so what I did instead was:

public function createChildren():Void
    {
                //create checkBox:
                cb = this.createClassObject(mx.controls.CheckBox, "cb",
1);
                 //add cb clicked listener:
                cb.addEventListener("click", this); 
    }

public function setValue(active:Boolean):Void r
    {
        //"active" refers to the "active" property in dataprovide
        //change the checkbox to the value in the dg's dataprovider
        //this gets called any time anything happens to/in the datagrid
        cb.selected = active;  
    }

function click():Void  //when cb is clicked, change dataprovider
    {
        //get current cell user is clicking in:
        var index_obj = getCellIndex();  
        //change dataprovider active property to checkbox value:
        listOwner.dataProvider[index_obj.itemIndex].active =
cb.selected;  
   }

>>Because you have _overridden_ setValue, you are skipping your 
>>parent class's implementation. The parent code for setValue 
>>will never get called _unless_ you use super.setValue in your 
>>function. That's how inheritance works. 

I understand how that part of inheritance works, and what method
overridding is :) (although, I have made it obvious to you and anyone
listening not all the details). What I was saying is my override class
will still get called, (as I expected) but how I was using it was
incorrect - I think we're understanding the same thing, just talking
past each other. :)

>>Other than that, I don't have enough context to go further, 
>>I'm afraid. Just trying to suggest obvious routes. Apologies 
>>if I'm being obscure.

Thanks very much for the help!  You made me rethink how I was using
those overriding functions, and I have it working now!

Jason Merrill
Bank of America
Learning and Organizational Effectiveness





_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to