I think you want to do
click="outerDocument.deleteRow(data.tld)"
The MXML compiler autogenerates an 'outerDocument' property on each
internal <mx:Component>.
- Gordon
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of xzhao006
Sent: Tuesday, March 13, 2007 2:28 AM
To: [email protected]
Subject: [flexcoders] Re: Need a hand with a scope problem
Can you try
<mx:Button label="" icon="@Embed('../images/delete.png')"
click="outerDocument.deleteRow( data.tld );" />
Xia
--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alexandre Lemaire" <[EMAIL PROTECTED]>
wrote:
>
> Inside of an mxml file, I have a datagrid, with a Button item
renderer as such:
>
>
> <mx:DataGridColumn headerText="delete" textAlign="center"
editable="false">
> <mx:itemRenderer>
> <mx:Component>
> <mx:VBox horizontalAlign="center">
> <mx:Button label="" icon="@Embed('../images/delete.png')" />
> </mx:VBox>
> </mx:Component>
> </mx:itemRenderer>
> </mx:DataGridColumn>
>
>
> In that Button, I would like to call a function that exists in the
same .mxml file
>
>
> public function deleteRow( id:String ):void{
>
>
> }
>
>
>
> Unfortunately, if I edit the button to read like:
>
> <mx:Button label="" icon="@Embed('../images/delete.png')"
click="deleteRow( data.tld );" />
>
> It writes that the function deleteRow doesn't exist, which I
imagine is a scope problem. How do I get around this?
>
> Thanks in advance,
> Alex
>