Mailing List
Home
Forum Home
Flash Pro
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Array property of MoveClip subclass problem

Array property of MoveClip subclass problem

2004-03-12       - By ryanm

 Back
Reply:     1     2     3     4  

> 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.