Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Vectors.<T> Broken by Format Code

Community Beginner ,
Jun 18, 2014 Jun 18, 2014

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!

TOPICS
ActionScript
930
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2014 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 19, 2014 Jun 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2014 Jun 19, 2014

yes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 24, 2014 Jul 24, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 25, 2014 Jul 25, 2014

that, i do not know.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 29, 2015 Jul 29, 2015
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines