Question
Stuck... Pease need help passing variable
Hi all....
I have an event listener added and it calls a function. Adding the event listener passes the event to the function automatically but what if i want to pass additional information to it?
So this:
addEventListener(Event.ENTER_FRAME, doEveryFrame);
Becomes this
addEventListener(Event.ENTER_FRAME, doEveryFrame(extra_var_passed));
function doEveryFrame(event:Event, extra_var_passed:Number):void {
//code here
}
It seems because I am trying to pass a new variable it no longer passes the event for me auto-magically.... how I go about passing that event myself?
Is it possible to even pass another variable like this??
I have an event listener added and it calls a function. Adding the event listener passes the event to the function automatically but what if i want to pass additional information to it?
So this:
addEventListener(Event.ENTER_FRAME, doEveryFrame);
Becomes this
addEventListener(Event.ENTER_FRAME, doEveryFrame(extra_var_passed));
function doEveryFrame(event:Event, extra_var_passed:Number):void {
//code here
}
It seems because I am trying to pass a new variable it no longer passes the event for me auto-magically.... how I go about passing that event myself?
Is it possible to even pass another variable like this??