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]>
.
> 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.

Reply via email to