• flash AS2. one line returns "Identifier expected!" the hell?
    13 replies, posted
i'm trying to make a variable that is dynamically changeable, the first part being "v" then having a variable v that counts up every time a "v" variable is made. heres my code for a new "v" variable... [QUOTE]var ["v"+v]:objectArray = new objectArray(pX, pY, vX, vY);[/QUOTE]for some annoying reason it returns "Identifier expected" on that line. i have done stuff like this before but with the attachMovie(); method. but not a custom method (objectArray). (which is in an .as file if it makes a difference)
Learn the basic syntax of ActionScript, then come back
What is this this doesn't even make sense
Use an array. I don't think you can do stuff like this in AS3. I'm pretty sure you can do this["image"+imageNum] but I don't think you can declare a variable like that.
This isn't even AS3, it's AS2. What the hell is this? [editline]06:08AM[/editline] I think it's asking you to identify the language because this is not actionscript.
He's asking you to help him and all you guys are doing is spitting out stupid answers.
Some of you really don't know what you are talking about. For example, this is works [cpp]var variable1:Number=1; var variable2:Number=2; var i=0; while (i<2){ trace(this["variable"+(i+1)]); ++i; }[/cpp] The problem is you can't declare a var like that.
ActionScript 2.0 seems to have an array-class (dynamically sizable), so can't you simply do [code]var vector:Array = new Array(); for(i = 0; i < 10; ++i) vector[i] = new Object(pX, pY, vX, vY);[/code]
hows bout this? [QUOTE]vecs = new Array(); Vecs = 0; v = 0; this["v"+v] = new Objcet{X:250, pY:150, vX:50, vY:20}; Vecs = vecs.push("v"+v);[/QUOTE] could this be valid?
What are you trying to do? Much simpler solution would be an array. var myArray=[]; var v = 0; myArray[v]=new Object(X:250, pY:150, vX:50, vY:20); [editline]02:23PM[/editline] I didn't try to compile it so don't take it literally.
basically im trying do what this website describes [QUOTE][URL]http://www.tonypa.pri.ee/vectors/start.html[/URL][/QUOTE] but with arrays.
The site describes a lot of things, you will have to be more specific.
sorry. basically i want to be able to create a vector with arrays and make it able to effect an object or make multiple vectors effect an object. using functions (not in .as files)
[code]var vector:Array = new Array(); for(i = 0; i < 10; ++i) vector[i] = new Array();[/code] ? :3
Sorry, you need to Log In to post a reply to this thread.