Hello, I run through an array and for each one add a movie clip which in turn has a button in it, and I need to add the onRelease action to the button. this is what i have tryed, but to no resolve:
[2] for (var x = 0; x < totalEvents; x++) { var eventNode:XMLNode = rootNode.childNodes[x]; xmlCount++;ImageHolder.attachMovie('eventImage', 'event'+(x+1), (x+3), {_x:pad, _y:0, _width:100}); var [b]button[/b]:String = 'event'+(x+1); ImageHolder.[b]button[/b].eventButton.onRelease = function () { trace ("onRelease called"); }; pad += 110; } [/2] If I add the follow after the loop it works
[2] ImageHolder.[b]event1[/b].eventButton.onRelease = function () { trace ("onRelease called"); }; [/2] But the number of items can changes, and would be better to do in the for loop. How could i do this, thanks.
|