Copy link to clipboard
Copied
Whenever I want to use a Vector.<T> I can't because if I use the "Format Code" button it breaks it! It will change:
var myVector: Vector.<T> = new Vector.<T>();
into
var myVector: Vector. < T > = new Vector. < T > ();
and when I compile it, it results in "Error 1084: Syntax Error: expecting identifier before lessthan" and "Error 1086: Syntax Error: expecting semicolon before greaterthan" (removing the space after "." fixes these errors)
I CANNOT find an answer to this problem, surely I am not the only one who has experienced this??? I've been able to deal with this by just using Arrays all the time but now I am required to use a Vector and now every time I format my code to clean it up I can to correct this! I desperately need a fix for this problem!
Copy link to clipboard
Copied
with auto-format errors, i copy the chunk of code i want to autoformat to another document, auto-format and then copy/paste back to the original.
Copy link to clipboard
Copied
Thats not really a viable solution for a file with thousands of lines of code that is still under development. For now I just put it in a separate class and call a static method to get the vector, but thats only a partial solution as well. Is this a known issue for the format code feature?
Copy link to clipboard
Copied
yes.
Copy link to clipboard
Copied
Are there any plans to fix this error with the code formatter?
Copy link to clipboard
Copied
that, i do not know.
Copy link to clipboard
Copied
function grabVector(type, length) {
//unfortunately as3 autoformat wrecks code.
//Use this for when you need a vector and love pressing autoformat
//in the flash IDE like me. Its not elegant, but hey, it works.
var className = getQualifiedClassName(type);
var vectorClass: Class = Class(getDefinitionByName("Vector.<" + className + ">"));
var retVar = new vectorClass(length);
return retVar;
}
var myVectorLength:uint=20;
var myVector = grabVector(Number, myVectorLength);
Note "Number" isnt a string, its the actual type typed out.
Thanks to "godfather" at stackoverflow.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now