homepage Welcome to WebmasterWorld Guest from 54.196.62.23
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Anonymous functions confusion
Passing parameters
TomWoozle

5+ Year Member



 
Msg#: 3943145 posted 1:23 pm on Jun 30, 2009 (gmt 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.

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved