I'm trying to put together a ski map that dynamically shows which mountain trails are open from data gathered from a xml file. The trails are referenced by trail id numbers. The trails have been statically placed on the stage. The instance name for each trail has a 'mc' prefix and the trail id number as the suffix. For example mc351.
I would like to run a loop that will allow me, depending on the TrailOpen attribute, display or hide the trail on the stage.
//trailList is the xml list of all trails on the mountain
for (var i:int = 0;i < trailList.length(); i++){
if (trailList.TrailOpen == "false"){
this['mc' + trailList+TrailID].visible = false;
}
else
{
this['mc' + trailList+TrailID].visible = true;
}
}
When I run this code I get the following error:
"TypeError: Error #1010: A term is undefined and has no properties." Any suggestions would be welcomed!! Thx.
I would like to run a loop that will allow me, depending on the TrailOpen attribute, display or hide the trail on the stage.
//trailList is the xml list of all trails on the mountain
for (var i:int = 0;i < trailList.length(); i++){
if (trailList.TrailOpen == "false"){
this['mc' + trailList+TrailID].visible = false;
}
else
{
this['mc' + trailList+TrailID].visible = true;
}
}
When I run this code I get the following error:
"TypeError: Error #1010: A term is undefined and has no properties." Any suggestions would be welcomed!! Thx.