Actionscript 2 wasn ' t, but a few things drove some developers. For example if you initialized A is variable with an Object, which is magically behaved like a static classmember, Due to the storage of the prototype. In ActionScript 3 The works just like expected, as you can.
//////////
The old problems in the AS2 were solved in the AS3. Initializes arrays and objects inline, and properties can become static members. (See Luar's book "ACTIONSCRIPT 2.0 vs. RIA application Development", page 80)
Inside the AS2.
Test1.as
Import Test2;
Class Test1 extends MovieClip
{
Public Function Test1 ()
{
var t1:test2 = new Test2 ();
var t2:test2 = new Test2 ();
}
}
Test2.as
Class Test2
{
private var A:array = new Array ();
function Test2 ()
{
A.push (a.length);
Trace (a);
}
}
The array becomes a static member, inconsistent with the expected result
Output
0
0,1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.