Hi, Here I've created a sample for this itemrenderer calling the function that exists in main appln. ( using outerdocument) check out the example http://todaystechnography.wordpress.com/2009/09/07/datagrid-with-combobox-radio-button-and-popup/
Thanks, Hemanth On Mon, Sep 14, 2009 at 6:41 PM, Arindam Mojumder < [email protected]> wrote: > *Application.application. myPrivateFunction*. This is the easiest way to > call the root function. Otherwise you have to use eventDispatcher. > As per my knowledge for simple case it is better to use > Application.application. myPrivateFunction than dispatch event. > If you got any other way please share with us. > > > 2009/9/14 Ravi Mishra <[email protected]> > > >> Hi McRain, >> >> You can write a custom event setting its bubble value true by default. >> Then dispatch this event from your itemRenderer and then listen >> (attach a listener function which will be the function you want to >> call) the same event on the application or the component where you are >> using itemRenderers. >> >> HTH, >> >> -Ravi >> http://achieveravi.blogspot.com >> >> On Sep 13, 11:16 am, "Subeesh Arakkan" <[email protected]> wrote: >> > Hi, >> > >> > You can only call the public function . >> > >> > Use the outerDocument keyword. So the item renderer script will be >> > something like this. >> > >> > private function myItemFunction():void{ >> > //Call from here to myPrivateFunction or myPublicFunctio >> > outerDocument. myPublicFunction(param); >> > >> > } >> > >> > Regards >> > Subeesh >> > >> > -----Original Message----- >> > From: [email protected] [mailto:[email protected]] >> On >> > >> > Behalf Of McRain >> > Sent: 11 September 2009 21:51 >> > To: Flex India Community >> > Subject: [flex_india:25205] How to call a function from itemRenderer >> > >> > Hi! >> > I have a code: >> > >> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >> > layout="absolute" > >> > <mx:Script> >> > <![CDATA[ >> > private function myPrivateFunction(param:Object):void{ >> > } >> > public function myPublicFunction(param:Object):void{ >> > } >> > ]]> >> > </mx:Script> >> > <mx:DataGrid id="dgGris" dataProvider="{mydp}" > >> > <mx:columns> >> > <mx:DataGridColumn headerText="HEAD" >> > dataField="item"> >> > <mx:itemRenderer> >> > <mx:Component> >> > <mx:Label >> > text="{myItemFunction()}"> >> > <mx:Script> >> > >> > <![CDATA[ >> > >> > private function myItemFunction():void{ >> > >> > //Call from here to myPrivateFunction or myPublicFunction >> > >> > } >> > >> ]]> >> > >> </mx:Script> >> > </mx:Label> >> > </mx:Component> >> > </mx:itemRenderer> >> > </mx:DataGridColumn> >> > </mx:columns> >> > </mx:DataGrid> >> > </mx:Application> >> > >> > How do I call a function (myPrivateFunction or myPublicFunction) from >> > the myItemFunction? Application.application. myPrivateFunction - do >> > not want to use. >> > Thank you. >> >> > > > -- > @rindam > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

