I am trying to make an array of 3 floats in Actionscript 1.0, but instead of incrementing the X & Y variables by 1, it just adds 1 to the end of the previous value. This has nothing to do with Flash, it is being used for an extension for a server that requires extensions in Actionscript 1.0.
var uVars = [];
uVars.X = 250;
uVars.Y = 3;
uVars.Z = 250;开发者_Python百科
uVars.X += 1;
uVars.Y += 0;
uVars.Z += 1;
trace(uVars.X);
Show us your output, please. I assume you mean "X & Z," not "X & Y."
I don't have AS1 handy, but I'm going to make a bet that the numbers are being treated as strings, since ECMAScript uses "+" for both addition and string concatenation. You need to find some AS1 way to make sure the interpreter knows you are talking about numbers, not strings.
What happens if you put a .0 after all your numbers? e.g. 250.0?
Note: I just looked it up, and parseInt and parseFloat have been available since AS1.
parseInt
parseFloat
精彩评论