Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Use variable value to access movie clip/button

10:25 am on Sep 16, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Feb 22, 2008
posts: 43
votes: 0


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:

for (var x = 0; x < totalEvents; x++) {
var eventNode:XMLNode = rootNode.childNodes[x];

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;

If I add the follow after the loop it works

ImageHolder.[b]event1[/b].eventButton.onRelease = function () {
trace ("onRelease called");

But the number of items can changes, and would be better to do in the for loop.

How could i do this, thanks.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members