  | |  | Array property of MoveClip subclass problem | Array property of MoveClip subclass problem 2004-03-12 - By ryanm
Back > class testClass extends MovieClip { > // properties: > var test:Array = new Array(); > // constructor: > function testClass() { > test.push("hi"); > onRollOver = function(){trace(test)}; > } > } > You are initializing the array in the class, which makes it a static member. That means all instances of the class use the same array, which would give you the results you are talking about. If you want it to be unique to each class, then you need to initialize it in the constructor, like this:
class testClass extends MovieClip { // properties: var test:Array; // constructor: function testClass() { test = new Array(); test.push("hi"); onRollOver = function(){trace(test)}; } }
ryanm
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106727 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
Earn $52 per hosting referral at Lunarpages.
|
|
 |