getURL help

might be a stupid question here, but why does this work here…


for (g=0; g<total; g++) {
  game0.mlbGD_btn.onRelease = function() {
   getURL("http://mlb.mlb.com/mlb/gameday/index.jsp?gid=" + gameday[0], "_blank");
  }
  game1.mlbGD_btn.onRelease = function() {
   getURL("http://mlb.mlb.com/mlb/gameday/index.jsp?gid=" + gameday[1], "_blank");
  }
 }

But not when i do it this way…


for (g=0; g<total; g++) {
  this["game" + g].mlbGD_btn.onRelease = function() {
   getURL("http://mlb.mlb.com/mlb/gameday/index.jsp?gid=" + gameday[g], "_blank");
  }
 }

I have a loop going in my movie that created a bunch of instances “game” and the button “mlbGD_btn” is within thoes instances. When i put the code the second way it always comes up undefined…

Is there a better way to do this other than having to type out code for each button.

Thank You