Hello First import that component, either via actionscript3 code or mxml-code. As soon as you imports that component to the native code-base, all of its attached properties are also available to the implementing class(code), and infact if the given property is of public-visibility, than you can easily call that property(function of the component) in your custom-class. See, Flex-framework is built on top of AS3, and AS3 is object oreinted...so apply OOPS concept that a member-method can be invoked from its class-object-instance...and its done.
On Tue, Mar 23, 2010 at 3:42 PM, 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. > > -- Regards Abhinav Mehta Developer | Blu Bangalore | INDIA -- 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.

