PDA

View Full Version : Use String as MC address


Erratic
10-12-2009, 06:29 PM
Hi, I am currently working on a school project that requires me to make a on-line game in flash. I am working in A.S.2 (CS4). The game is tile based and I need to be able to select one tile, and the have all the tiles within a certain radius be highlighted. The most important data can be found the the MC name e.g. T:3,5:0 , which breaks down as T: tile, 3,5:location (in 2D array), and 0: wall. this information is also available in a 2D array. I have a vague idea of how I would do this, with something along the lines of

//a FOR loop to cycle through and check things
MC="_root.game."+//code to decide the MC name;
MC.overlay.gotoAndStop(3)


Although the thing do not know at the moment is how to get flash to treat the MC string as an address not a string like it is.

[Paul Ferrie ]
11-19-2009, 10:44 AM
eval() should help you out here

MC=eval("_root.game."+i)