PDA

View Full Version : help for concatenation


rexleekl
11-04-2004, 02:19 AM
hi there
it sounds easy but it doesn't work why?

for(i=0; i<10; i++){
_root.my+i+_mc._visible = false;
//"_root.my"+i+"_mc._visible" = false;
//_root.my add i add_mc._visible = false;
//_root.my&i&_mc._visible = false;
}

// all are not workable....

Iamme
11-04-2004, 03:40 AM
hi there
it sounds easy but it doesn't work why?

for(i=0; i<10; i++){
_root.my+i+_mc._visible = false;
//"_root.my"+i+"_mc._visible" = false;
//_root.my add i add_mc._visible = false;
//_root.my&i&_mc._visible = false;
}

// all are not workable....

I bet it would work if you did this:

for (i=0; i<10; i++) {
_root["my"+i+"_mc"]._visible = false;
}


What this does is evaluated whatever is in the [] as a command rather than a string.

rexleekl
11-05-2004, 06:09 PM
for (i=1; i<13; i++) {
_root["b"+i+"_btn"].onPress = function() {
stopAllSounds();
gotoAndStop("q"+i);
music_sound = new Sound();

//this one doesn't work, any ideas???? :mad:
music_sound.loadSound("mp3/"+i+".mp3", true);
music_sound.start();
};
}