I put a number of instances of a movie clip from the library on the stage and I need a method to work for all of those instances which I name 'mc_file1', 'mc_file2' and so on. Here is the code. I think there is a problem with the path.
Code:
// Variables declarations
var counter:Number;
var totalTracks:Number;
var loadVars:LoadVars = new LoadVars();
// Loads an external file
loadVars.load("totalTracks.txt");
// When finished loading
loadVars.onLoad = function():Void {
totalTracks = Number(loadVars.totalTracks);
// Creates 'totalTracks' number of instances
for(counter = 1; counter <= totalTracks; counter++) {
mc_clipX.attachMovie("mc_file", "mc_file" + counter, currentDepth + 1, {_x:5, _y:5 * counter});
currentDepth++;
}
// Until this point everything works fine. But this method does not work. What is the problem ?
_root['mc_clipX.mc_file' + 1].onRollOver = function():Void {
this.gotoAndStop("over");
}
// ------------------------------------------------
// If I put this it works:
mc_clipX.mc_file1.onRollOver = function():Void {
this.gotoAndStop("over");
}
// ------------------------------------------------
// But I need this method to work for all the 'totalTracks' number of instances.
}