Using a variable String as an instance name

Hey Everyone,

I’m making a map and when you hover over a state it has a pop up with some information, pretty easy stuff. Well, I’m using this as my code(HoverCaption Tutorial)…

 
Missouri.onRollOver = function() {
captionFN(true, this._name + "
 Carriers: " + ranString[numState] + 
"
 Total of " + ranCount[numState] + " Carriers.", this);
this.onRollOut = function() {
captionFN(false);
};
};

What I’d like to do is instead of having to make this for every state just pass in the instance name which is the name of the state. I thought my code would look something like this.

for button…

 
on (rollOver){
var numState:Number = 25;
var strState:String = this._name;
}

for other code…

 
strState.onRollOver = function() {
captionFN(true, this._name + "
 Carriers: " + ranString[numState] + 
"
 Total of " + ranCount[numState] + " Carriers.", this);
this.onRollOut = function() {
captionFN(false);
};
};

Well, that doesn’t work, I didn’t know if there is a way to do that, maybe threw a method. Thanks for the help!