Be a Supporter!

Rundown of variable protect levels?

  • 289 Views
  • 1 Reply
New Topic Respond to this Topic
Jigganis
Jigganis
  • Member since: Nov. 7, 2003
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Rundown of variable protect levels? 2008-10-11 15:17:20 Reply

I know what the modifiers public, internal, protected, and private are, and how they work in relation to variables, but, being a newb to programming, I have to ask here to see if these modifiers are only for variables in classes and packages or something. The book I'm reading on AS3 seems to only be using those modifiers with variables in classes so far, and I'm wondering whether they work in non-object-oriented programming.

See, I want a variable in a movie I'm working on to be available across scenes and am looking for a way to make it so. If maybe there's some kind of modifier to use that'll make it so. And I was hoping to get the solutions both in AS2 and AS3, for some kind of educational comparison. Can anyone be gracious enough to help?

Moonkey
Moonkey
  • Member since: May. 11, 2007
  • Offline.
Forum Stats
Member
Level 07
Programmer
Response to Rundown of variable protect levels? 2008-10-11 17:07:23 Reply

Variables declared in the timeline become part of the object whose timeline you're coding in. They'll be available whatever frame or scene you go to within that object.

I don't think you're allowed to use private/public etc for timeline variables. I guess they aren't part of the class definition so they just get dumped into the object's lookup table, which seems to be public.