are you using that component in the current file ? if yes then use component id.method name if no then make the function static and use component name . method name
Akshar Kaul On Tue, Mar 23, 2010 at 15:42, Gaurav <[email protected]> wrote: > Thanks Shalu, > But I am lookiing something else - > > Problem Description:- I have a button on application mxml file, on > Click even of this button I need to call a method which is written in > a different component. > > > > On Mar 22, 10:45 pm, shalu popli jain <[email protected]> > wrote: > > refer below example: > > > > *CustomCompoent:* > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:Canvas > > > > xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"> > > > > <mx:Script> > > > > <![CDATA[ > > > > import mx.controls.Alert;public function displayAlert():void > > > > { > > > > Alert.show( > > > > } > > > > ]]> > > > > "Hello!"); > > > > </mx:Script> > > > > </mx:Canvas> > > > > *Main.mxml:* > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:Application > > > > layout=" > > > > xmlns:mx="http://www.adobe.com/2006/mxml"vertical" > > xmlns:components="components.*"> > > > > <mx:Script> > > > > <![CDATA[ > > > > private function creationCompleteHandler():void > > > > { > > > > customComponent.displayAlert(); > > > > } > > > > ]]> > > > > </mx:Script> > > > > </mx:Application> > > > > *So, the conclusion is, the method should be public.* > > > > <components:CustomComponent id="customComponent" > > creationComplete="creationCompleteHandler()"/> > > > > On Mon, Mar 22, 2010 at 9:47 PM, Gaurav <[email protected]> wrote: > > > > > Hi, > > > How can we access a method (which is written in a component) from your > > > application mxml. Can anyone suggest simple way. > > > > > Thankyou very much > > > > > -- > > > 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]<flex_india%[email protected]> > <flex_india%2bunsubscr...@googlegrouÂps.com> > > .> For more options, visit this group at > > > > http://groups.google.com/group/flex_india?hl=en. > > > > > > > > - Hide quoted text - > > > > - Show quoted text - > > -- > 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]<flex_india%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/flex_india?hl=en. > > -- 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.

