[Flash 8 PRO, Actionscript 2.0]
I have a stage full of 250 different movieclips. Each movieclip is a rabbit that has a different name. My code is in a frame on the main timeline. There is a dynamic text box that will display the name of a rabbit when the mouse rolls over it. I can do it like this:
rabbit1.onRollOver = function() {
textBox= this._name;
}
...but I would have to write this code 250 times, for each of the movieclips. I want to do it using "modular code", where I only write a single function that handles all movieclips. However, I don't know any code for leaving the name of the movieclip an unknown variable.
rabbit1.onRollOver = function() {
textBox= this._name;
}
rabbit2.onRollOver = function() {
textBox= this._name;
}
rabbit3.onRollOver = function() {
textBox= this._name;
}
....and on and on until 250 are written!!!
This method would be possible, but way impractical. What if I want to make changes later? I would have to edit the code in 250 different places! Holy moley!
("whatever MC your mouse is over right now").onRollOver = function() {
textBox= this._name;
}
This one is my intention. I would only write this code once. You can see how simple it is to maintain.
Anybody know how I can do this? Thanks in advance.