Arrays/Vectors would be more efficient, but if you're looking for a way to dynamically 'create a variable' on runtime as stated in the title you will have to make sure the class is dynamic (if you're using a document class).
You can use the array access operator to create variables dynamically, with something like this in your code:
this["varname"] = 9999;
Where you replace varname with another variable that keeps variable name that you want to create.
var numPoint:int = 4;
var varName:String = "point" + numPoint;
this[varName] = 9999;
this will create a variable named point4 and give it a value of 9999.
Main Topics
Browse All Topics





by: courtthreePosted on 2009-06-11 at 16:42:23ID: 24607977
Try an array push method.
Declare an a new array outside of the function:
var aMyArray:Array = new Array();
Then, after you write each line, push the clip on to the array:
aMyArray.push(point2);
Then you can access each one by using array access notaton:
aMyArray[0], aMyArray[1] etc...