Scope issue: Since your itemRenderer is a child, you have to 
reference the parent.

Change: <mx:Button width="15" height="15" toolTip="Add to Cart"
icon="@Embed('/assets/shoppingcart_add_16.png')" click="orderItem
()" />

TO: <mx:Button width="15" height="15" toolTip="Add to Cart"
icon="@Embed('/assets/shoppingcart_add_16.png')" 
click="parentDocument.orderItem();" />

-TH


--- In [email protected], "g8torjoe" <[EMAIL PROTECTED]> wrote:
>
> I have a dataGrid control with an itemRenderer containing a 
button. 
> The button has a click handler which is defined as a private 
function
> in the script tags.  Every time I try to compile I get an error:
> "1180: Call to a possibly undefined method orderItem."  A PARTIAL
> piece of the code is below.  I can't seem to figure out why this is
> happening.  Thanks
> 
> <mx:DataGrid id="dgPart" dataProvider="{partList}" 
editable="false">
>   <mx:columns>
>   <mx:DataGridColumn id="partNum" headerText="Part #"
> dataField="PART_NO" editable="false" width="75" sortable="true" />
>   <mx:DataGridColumn id="partName" headerText="Part Name"
> dataField="PART_NAME" editable="false" width="450" />
>   <mx:DataGridColumn id="orderPart" headerText="Order">
>     <mx:itemRenderer>
>       <mx:Component>
>         <mx:Button width="15" height="15" toolTip="Add to Cart"
> icon="@Embed('/assets/shoppingcart_add_16.png')" click="orderItem
()" />          
>       </mx:Component>
>     </mx:itemRenderer>
>   </mx:DataGridColumn>
>   </mx:columns>       
> </mx:DataGrid>
> 
> private function orderItem():void
> {
>   var eventObj:CatalogEvent = new CatalogEvent("order");
>   dispatchEvent(eventObj);
> }
>







------------------------ Yahoo! Groups Sponsor --------------------~--> 
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to