<mx:Script>
        <![CDATA[
            import flash.events.MouseEvent;

            private function clickHandler(evt:MouseEvent):void {
                trace(evt.currentTarget.id);
            }

        ]]>
    </mx:Script>

    <mx:Button id="IAMAButton1" label="validate" click="clickHandler(event)" />
    <mx:Button id="IAMAButton2" label="validate" click="clickHandler(event)" />
    <mx:Button id="IAMAButton3" label="validate" click="clickHandler(event)" />


You should probably consider joining FlexCoders:
http://tech.groups.yahoo.com/group/flexcoders/

regards,
Muzak

----- Original Message ----- 
From: "macromedia flash" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, September 08, 2007 11:02 PM
Subject: [Flashcoders] Flex - How to get button ID name?


> Hi there,
>
> I am working on Flex and need to get the button ID in function, do you have
> any ideas?
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <!-- FLEX 2 SOLUTION -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
>
>    <mx:Script>
>        <![CDATA[
>        private function getHandler():void{
>            //how to get the button ID name here => IAMAButton "x" ?
>        }
>
>        ]]>
>    </mx:Script>
>
>
>    <mx:Button id="IAMAButton1" label="validate" click="getHandler()" />
>
>    <mx:Button id="IAMAButton2" label="validate" click="getHandler()" />
>
>    <mx:Button id="IAMAButton3" label="validate" click="getHandler()" />
>
> </mx:Application>


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to