Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>weltraumpirat is right only in that the code will compile, it's still actionscript 1/2 notation (AVM1). You said you want to know the "AS3 way".... and one major difference and benefit of AS3 (AVM2) over AS1/AS2 (AVM1) is strict typing. Hence the creation of the Vector object, aka a strictly typed array (and it's faster because of that strict typing). Here is the proper way to initialize a typed array with 1 or more defined objects:</p> <pre><code>var vector:Vector.&lt;String&gt; = Vector.&lt;String&gt;(["v1", "v2", "v3"]); </code></pre> <p>See more here:</p> <p><a href="http://www.daveoncode.com/2009/04/06/actionscript-vector-class-initialization-with-a-source-array/" rel="nofollow">http://www.daveoncode.com/2009/04/06/actionscript-vector-class-initialization-with-a-source-array/</a></p> <p><strong>Edit</strong> <br>For all the people who don't know what they're talking about:</p> <p><a href="http://www.mikechambers.com/blog/2008/09/24/actioscript-3-vector-array-performance-comparison/" rel="nofollow">http://www.mikechambers.com/blog/2008/09/24/actioscript-3-vector-array-performance-comparison/</a></p> <p>Simple test, vector == 40% faster than array</p> <p><a href="http://www.masonchang.com/blog/2011/4/21/tamarin-on-llvm-more-numbers.html" rel="nofollow">http://www.masonchang.com/blog/2011/4/21/tamarin-on-llvm-more-numbers.html</a></p> <p>Summary of tamarin JIT tests, typed variables performing 20% or more faster than un-typed in every scenario.</p> <p>For the people who REALLY don't know what they're talking about, Tamarin IS the flash virtual machine (at least the open source component, the core minus the UI and other things).</p> <p><strong>Edit... again.. sigh</strong><br> For people who do not understand what "context" is... when I say that the vector is FASTER... I'm speaking of the overall performance of the object in the virtual machine. This is not my own claim, it comes from adobe themselves and there are benchmarks from a flash platform evangelist included in my answer ( or rather a link to ). Maybe the people who are arguing with me don't have English as their first language.....</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload