[Flash MX] Instance name not eval'ing correctly

Hey everybody,

I have a global map, when the user selects a continent it loads a seperat swf for that area. The continents grab variables from a database, and bring a bunch of variables into the movie.

One group is for the names of countries. It grabs the country name and it’s 2 letter code. Then passes the country name to the local movieclip with that same instance name.

This works well for the most part. A couple countries don’t load. Right now I’m looking at Asia. The country od Malaysia with it’s code of “MY” produces errors half the time. Well most of the time.

This is what I get most of the time, it’s the trace action from the code below. I tried ignoring Maldives, and tried adding a dummy clip too, that didn’t seem to help. There are other countries with apostrophes in their names, so that’s not it either.

16 - _level0.KR - KR - Korea, republic of
17 - _level0.KG - KG - Kyrgyzstan
18 - _level0.LA - LA - Lao people’s democratic republic
19 - 152 - MY - Malaysia
20 - - MV - Maldives
21 - _level0.MN - MN - Mongolia
22 - _level0.MM - MM - Myanmar

Here is the code that sets the names up, and does the trace above.

[AS]
for (n = 1; n <= this.countryCount; n++) {
_root[eval(“this.countryCode”+n)].countryName = this[“countryName”+n];
trace(n + " - " + _root[eval(“this.countryCode”+n)] + " - " + eval(“this.countryCode”+n) + " - " + this[“countryName”+n]);
}
[/AS]

It happens on a couple other continents, though I haven’t looked at it much there. Has anyone seen this before, is “MY” some constant I can’t use? Please help. :slight_smile:

I seem to have found the problem. I have “tooltips” that pop up when countries are mouseovered. I tweaked some code that was in a component to keep the tooltips on the stage. Even though they were within a function, they were overlapping. The variables in the tooltip, mx and my. Two letter code for Malaysia (and also Mexico was a problem,) MX and MY. I’m glad I figured that out, it was pretty random. I guess I’m too used to using PHP, and having global variables off, etc.
:tie: