Welcome to WebmasterWorld Guest from 54.162.168.187

Forum Moderators: open

Message Too Old, No Replies

Anonymous functions confusion

Passing parameters

     
1:23 pm on Jun 30, 2009 (gmt 0)

New User

10+ Year Member

joined:Nov 30, 2004
posts:3
votes: 0


Hi,

I'm confused as to how to fix a problem with anonymous functions in actionscript. I'm sure it's simple and I'm just being dumb.

I have an array of integers, and an array of generated movieclips.

As I generate the movieclips I simply want to assign an onRelease function that uses the respective integer from the array to do some stuff.


myMC[i].onRelease = function() { doStuff with i };

Of course inside the anonymous function i is undefined. How can I fix this? My only solution ends up with all the i values being set to the last one (which I understand why but dunno the solution).

Any tips would be very greatly appreciated.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members