how to send extra-parameter to the event handler while calling the addEventListener

3 views
Skip to first unread message

HISSAM

unread,
Oct 7, 2008, 6:38:06 AM10/7/08
to Flex India Community
how to send extra-parameter to the event handler while calling the
addEventListener

T.addEventListener(FlexEvent.CREATION_COMPLETE,getTEvents(event,T.id));//
error//event
//
undefined

public function getTEvents(e:FlexEvent,s:string):void
{
if(e.currentTarget.btnSelect!=null)
{e.currentTarget.btnSelect.addEventListener( MouseEvent.CLICK,btnSelectClick);}
}
private function btnSelectClick(e:MouseEvent):void
{

}

I'm getting error

I have to send the T.id since there many dynamic T


how to send extra-parameter to the event handler while calling the
addEventListener

Satish பேர கேட்டா சும்மா அதுருதில

unread,
Oct 7, 2008, 7:20:34 AM10/7/08
to flex_...@googlegroups.com
Hi Hissam,


Check out this code..Hope this code solves your problem..
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  creationComplete="call()" layout="absolute"  xmlns:ns1="components.*">
    <mx:Button x="173" y="172" label="click" id="button1" />
    <mx:Script>
        <![CDATA[
        import mx.controls.Alert;
            public function call():void
            {
                var a:String="hello"
                button1.addEventListener(MouseEvent.CLICK,function(e:MouseEvent):
                void{display(e,a);});
           
            }
            public function display(evt:MouseEvent,a:String):void
            {
                Alert.show(a);
            }
        ]]>
    </mx:Script>
   
</mx:Application>

Cheers
Satish

ravi

unread,
Oct 7, 2008, 7:39:59 AM10/7/08
to Flex India Community
Hi Hissam,

Check out the following link.

http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=2&postId=9144

-Ravi

On Oct 7, 4:20 pm, "Satish பேர கேட்டா சும்மா அதுருதில"
<mailsat...@gmail.com> wrote:
> Hi Hissam,
>
> Check out this code..Hope this code solves your problem..
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> creationComplete="call()" layout="absolute"  xmlns:ns1="components.*">
>     <mx:Button x="173" y="172" label="click" id="button1" />
>     <mx:Script>
>         <![CDATA[
>         import mx.controls.Alert;
>             public function call():void
>             {
>                 var a:String="hello"
>
> button1.addEventListener(MouseEvent.CLICK,function(e:MouseEvent):
>                 void{display(e,a);});
>
>             }
>             public function display(evt:MouseEvent,a:String):void
>             {
>                 Alert.show(a);
>             }
>         ]]>
>     </mx:Script>
>
> </mx:Application>
>
> Cheers
> Satish
>

HISSAM

unread,
Oct 7, 2008, 7:51:57 AM10/7/08
to flex_...@googlegroups.com

Thanks a ton guys!!
It worked!!Cheers
-----------------------------
Warm Regards,
 HISSAM,
 Soft Engg,
 iThinkLabs Pvt Ltd.
 India.
website:http://www.ithink-labs.com
           http://www.yureekah.com
------------------------------
Reply all
Reply to author
Forward
0 new messages