In ActionScript 3, how can I pass the current value of an array in a loop to an event listener
问题 Code Example: var gospels : Array = ["john", "mark", "matthew", "paul"]; for each (var book : String in gospels) { var loader : URLLoader = new URLLoader(); loader.load(new URLRequest("http://example.com/" + name)); trace(book) // outputs current value of array loader.addEventListener(Event.COMPLETE, function(e : Event) : void { trace(book); // prints paul 4 times }); } How can I get the event listener to use the value of the array in the loop when the event listener's function was called? I