Muzak - I share some of your frustrations though I see why they've done it.
So what do people think the best practice for this is? I don't like the idea of not declaring the MCs/Buttons in the class because it's a great help knowing what a class can deal with without having to refer to the Flash file constantly. Adjusting the publish settings and setting the instances to public doesn't seem great. Using getChildByName is a bit of a long solution too! Also how would FDT (when the AS3 version is finally released!!) handle this? Without declaring the instances they wouldn't have access to the Flash stage before compilation would they? So I guess you'll have to declare them for that functionality to work. Thanks, Sunil -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Francis Cheng Sent: 13 July 2007 02:34 To: [email protected] Subject: RE: [Flashcoders] Accessing MovieClips on a timeline from an AS3 class 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

