There are a few ways to do this but the easiest is to add a value to your
object that will be updated in the item renderer, perhaps in the set data
function. You could also use an event and a public property in your item
renderer.
var myObject = new myClass();
override public function set data(value:Object):void
{
//value is the object from your list
myObject = value as MyClass;
}
private function buttonClick()
{
myObject.randomNumber = MyRandomNumberGen();
}
You should now be able to access randomNumber in your application.
This will require you to parse your ArrayCollection into an object.
--- In [email protected], "Pilby" <i...@...> wrote:
>
> Thanks for responding, Tracy.
>
> Let's say this is an application that allows generation of license numbers.
> Imagine this:
>
> You have 3 columns in the datagrid. The first and second columns are the
> first and last names of a person. The third column is a button (which is
> really part of an MXML component) that has it's 'label' set as "Click to
> generate license number". When the user clicks the button, the logic to
> generate the license number is within the component and will be output to
> the label property of the button, and the button will no longer be
> clickable. The application allows multiple people to be listed in the
> datagrid. Outside the datagrid, there is a button that says "Click to print
> all".
>
> Given the specs I described so far, it's clear that I have to be able to
> iterate through each row in the datagrid, extracting the data from each
> column of each row. Typically, I would just get the dataProvider array
> collection object, and the problem would be solved. But because the license
> number is being output through the label property of the button (which is
> part of a MXML component) and is not part of the original dataProvider data,
> I can't go that route.
>
> I figured I now have to somehow iterate through each row, grabbing the data
> of each column of the row and storing it somehow. Is there a way for me to
> get the license number from the label property of the buttons?
>