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


----- Original Message ----- 
From: "Francis Cheng" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, July 12, 2007 11:02 PM
Subject: RE: [Flashcoders] Accessing MovieClips on a timeline from an
AS3 class


It looks to me like Matt avoided the namespace conflict by using a
private variable that differs from the instance name in case only. Note
that he uses all lowercase 'fullscreen' to represent the instance name
'fullScreen'.

Just to provide some background as to what's going on here, Flash CS3 is
automatically declaring variables for all instances on the stage. In
other words, Matt already has access to the instance name in his
document class, without having to declare it in his class. That's why
you get the duplicate name error if you declare it yourself. So Matt's
original code example will work if you simply delete the declaration:
"private var fullScreen:MovieClip".

If you don't want Flash CS3 to automatically declare variables, you can
turn off that feature by going to the Publish Settings dialog box,
selecting the "Flash" tab, and clicking on the "Settings" button. In the
"ActionScript 3.0 Settings" dialog box that appears, uncheck the
checkbox labeled: "Automatically declare stage instances".

If you disable this feature, note that Flash CS3 still expects those
variables to exist and will still execute assignment statements that
bind those variables to the instances on stage. 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).

Francis Cheng | Sr. Technical Writer | Adobe Systems Incorporated



_______________________________________________
[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

Reply via email to