How do you pass parameters / variables through event listeners? I\'ve overcome this problem fairly effectively using anonymous functions; which is an incredibly simple solut
You can do the following, which basically is a cleaner way of passing custom data.
example code:
public function myCustomEvenListener(e:MouseEvent,myCustomData:Object)
{
//Do whatever you wnat with myCustomData Object here...
}
//this is the function where you add event listeners to components..
public function init():void
{
var myCustomObject:Object=new Object();
myCustomObject.url="http://xyz.com/image.jsp";
myCustomObject.anydata="You can Add anything here";
mycomponent.addEventListener(MouseEvent.CLICK,function (e:MouseEvent) : void {
myCustomEventListener(e,myCustomObject);
});
}
This is just another way of using anonymous functions though....