Skip to main content
Known Participant
June 18, 2014
Question

Vectors.<T> Broken by Format Code

  • June 18, 2014
  • 3 replies
  • 989 views

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!

This topic has been closed for replies.

3 replies

Participant
July 30, 2015

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.

Known Participant
July 25, 2014

Are there any plans to fix this error with the code formatter?

kglad
Community Expert
Community Expert
July 25, 2014

that, i do not know.

kglad
Community Expert
Community Expert
June 18, 2014

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.

Known Participant
June 19, 2014

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?

kglad
Community Expert
Community Expert
June 20, 2014

yes.