Forum Moderators: open

Message Too Old, No Replies

Need Help Passing a variable to a function

Actionscript 3 question... passing variables

         

Demaestro

5:49 pm on Aug 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi all....

Been fumbling my way through Flash and I am trying to do some dynamic animations.

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
}

I have tried but this either isn't possible or my syntax is whack

Demaestro

5:54 pm on Aug 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ok it looks like because I am trying to pass 1 variable it no longer passes the event for me auto-magically.... any ideas on how I go about passing that event myself?