Sorry, I wasn't clear about my theory. Let me try again. I think that you have to declare variables that represent stage instances as public because Flash CS3 automatically executes an assignment statement at runtime that involves those variables. If those variables are declared as private, they are invisible at runtime, so the assignment attempt results in an error.
Francis -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: Thursday, July 12, 2007 6:14 PM To: [email protected] Subject: Re: [Flashcoders] Accessing MovieClips on a timeline from an AS3 class I'm aware of the differences, I just don't understand why it *has* to be public. Or put differently, I don't like that it has to be public. If I had to guess, I'd say it has something to do with the display list. regards, Muzak ----- Original Message ----- From: "Francis Cheng" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, July 13, 2007 2:45 AM Subject: RE: [Flashcoders] Accessing MovieClips on a timeline from an AS3 class I'm guessing that the odd reason has something to do with the behavior of the "private" attribute in AS2 versus AS3. As most of you are aware, the "private" attribute in AS2 only restricts access at compile time. In AS3, however, "private" restricts access at both compile time and runtime. Just a guess, though, I could be barking up the wrong tree. Francis -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: Thursday, July 12, 2007 5:21 PM To: [email protected] Subject: Re: [Flashcoders] Accessing MovieClips on a timeline from an AS3 class > This means that you either have to declare the variables yourself (and they have to be public, by the way) > or declare the class as dynamic so that the variables can be added at runtime (specifically, at the time the > assignment statements are executed). I think the "has to be public" thing is one of the most annoying things that has changed between AS2 and AS3. In AS2 you can place assets on stage and declare them as private in your class. In AS3 this is not allowed/possible for some odd reason. regards, Muzak _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

