homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

Use variable value to access movie clip/button

5+ Year Member

Msg#: 3745549 posted 10:25 am on Sep 16, 2008 (gmt 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.


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