The title says everything...
Here is the example:
centerx = 275;
centery = 200;
plussx = 26;
plussy = 15;
layern = 1;
terrainn = 1;
placer = 0;
GRASS = new Array();
while (layern != 2){
_root.attachMovie("terrainG", "GRASS[terrainn]", layern); //<<<<< How can I do something like that?
GRASS[terrainn]._x = centerx+plussx*placer;
GRASS[terrainn]._y = centery+plussy*placer;
terrainn++;
layern++;
placer++;
}
Thanks! that worked!
Also do you know how do I convert a string to integer? I've tried using Number() and parseInt(), they doesn't seem to work... Someone said that I should try creaning the string by running it in to "regEx" I am not sure how... WHat I know is that it is possible that my string has some hidden characters like " " or even unprintable..
Any ideas?
AS2 does not have an integer class, so if you want to convert a string to a number you can use the Number(string) approach so long as the characters are numeric. Using parseInt can work but only when the numeric characters are in the front of the string. If you have some other mix of alphanumeric characters, then you would need to go thru the string and revise it to only have the numeric elements. For this you could loop thru the string and test each character in it to see if it is a number... if not, do not include it in the string destined to be the numeric result.
You could make use of the isNaN() function as one option. While looping you would use something like...
... if(!isNaN(currentCharacter)) {
// include it because it is numeric
}
You could also have a string with the numeric characters in it ( as in "0123456789") and use the indexOf method of the String class to check for the numeric characters. While looping you would use something like...
... if(numericString.indexOf(currentCharacter) > -1) {
// include it because it is numeric
}
North America
Europe, Middle East and Africa
Asia Pacific