Hey all, I have a datagrid and I put a custom component of a button on
one column. The problem I have is setting the drag initiator... I
programmed an AS3 function to set the initiator and when I insert the
mouseDown property to call the function I get the error "Call to a
possibly undefined method dragIt." Why am I getting this error when I
have the function coded inside the app component and I have no
spelling errors? Here is a sample of my code for better understanding.
Regards
Sal
<mx:Script>
<![CDATA[
import mx.core.DragSource;
import mx.managers.DragManager;
import mx.events.DragEvent;
import mx.core.UIComponent;
public function dragIt(event:MouseEvent):void{
var ds:DragSource = new DragSource();
ds.addData(data, "item");
DragManager.doDrag(this, ds, event);
}
]]>
</mx:Script>
<mx:DataGrid id="fixedGrid" width="100%" height="100%"
dataProvider="{fixed.lastResult.fixed.product}">
<mx:columns>
<mx:DataGridColumn width="40">
<mx:itemRenderer>
<mx:Component>
<mx:Button label="${data.loadprice}" toolTip="Add To Cart"
mouseDown="dragIt(event)" click="dispatchEvent(new
Event('purchase',true))"/>
</mx:Component> </mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>