weltraumpirat is only right that the code will be compiled, this is still actioncript 1/2 (AVM1). You said you want to know the “AS3 method” .... and one significant difference and advantage of AS3 (AVM2) over AS1 / AS2 (AVM1) is strict typing. Therefore, creating a Vector object, the so-called strictly typed array (and this is faster because of this strict typing). Here is the correct way to initialize a typed array with 1 or more defined objects:
var vector:Vector.<String> = Vector.<String>(["v1", "v2", "v3"]);
More details here:
http://www.daveoncode.com/2009/04/06/actionscript-vector-class-initialization-with-a-source-array/
Edit
For all people who don’t know what they’re talking about:
http://www.mikechambers.com/blog/2008/09/24/actioscript-3-vector-array-performance-comparison/
Simple test, vector == 40% faster than array
http://www.masonchang.com/blog/2011/4/21/tamarin-on-llvm-more-numbers.html
Summary of tamarin JIT tests, typed variables that execute 20% or more faster than not typed in each scenario.
For people who REALLY don't know what they are talking about, Tamarin is a Flash virtual machine (at least an open source component, a kernel minus the user interface and other things).
Change ... again .. sigh
For people who don’t understand what “context” is ... when I say that the FASTER vector ... I’m talking about the overall performance of an object in a virtual machine. This is not my own statement, it comes from adobe itself, and in my answer (or rather, in the link) there are landmarks from the evangelist of the flash platform. Perhaps people who argue with me do not have English as their first language .....
user562566
source share