[Tweener] Using passing variables through event listeners to trigger correct tween

Makc makc.the.great at gmail.com
Wed Dec 10 06:46:42 PST 2008


Hi

On Wed, Dec 10, 2008 at 2:16 PM, Graeme Blackwood <grayhammy at hotmail.com> wrote:
> Somehow the value of variable "i" is not getting through to my functions.

navigationArray[i].addEventListener(MouseEvent.ROLL_OVER,
function(e:MouseEvent):void {navButtonRollOver(e,i);}

take a look at this part:

function(e:MouseEvent):void {navButtonRollOver(e,i);}

as with in any other function, you pass e only, but expect to use e
and i, and naturally this does not work, since your function does not
know where to get that i from.

so, either what Baluta Cristian said, or, use e.currentTarget to
figure out value for i.


More information about the Tweener mailing list