PDA

View Full Version : Passing parameters in event callback function


flexy
08-10-2006, 08:55 AM
Does anyone know how you can pass extra parameters to an addEventListener callback function? Currently, my callback accepts the parameter event:EffectEvent, but also would like to pass in an integer.

I've tried the following, but I get an error (1120: Access of undefined property event), I appreciate this is because it doesn't know what event is, but how else do I pass it?


tween_objects[i].addEventListener( EffectEvent.EFFECT_END, effectEnd( event, i ) );
tween_objects[i].target = shapeCanvas_object[i];
tween_objects[i].duration = 1000;
tween_objects[i].heightTo = s;
tween_objects[i].play();

private function segEffectEnd(event:EffectEvent,index:int):void
{
shape_object[index].width = shapeCanvas_object[index].width;
shape_object[index].height = shapeCanvas_object[index].height;

}



Bit lost I'm affraid. Any ideas?

Tink
08-10-2006, 09:51 AM
hmmm only 3 posts away

http://www.actionscript.org/forums/showthread.php3?t=104284

flexy
08-10-2006, 09:52 AM
Bugger! I'm clearly not paying attention this morning... Good jobs there's no meetings! :D