1 Reply Latest reply on Oct 16, 2008 5:15 AM by Devendran

    Class Members

    tegnegi Level 1
      What security is provided by the private variables in flash. I know it provides encapsulation, but how exactly. When a user uses a class, that means he has the class .as file. He can simply open it up and see the code. When we load a movie clip that uses a class into another movieclip, the parent movie clip can access the private variables of the class used in child movieclip. For components, yes they are useful, but what i wanted is a scenario (other than components) where private variables provide security to our code in the class.

      Moreover I can access private variables if i dont use strict data typing. Use can also access private variables if u've imported a class in first frame and try and access its private variables in another frame. A person (not the author)can use any of these things to gain access to private variables. Please help me in understanding the concept of private variables.
        • 1. Re: Class Members
          Devendran Level 1
          The Below content is taken from the "Adobe CS3 HELP".

          Specifies that a variable or function is available only to the class that declares or defines it or to subclasses of that class. By default, a variable or function is available to any caller. Use this keyword if you want to restrict access to a variable or function. This keyword is intended as a software development aid to facilitate good coding practices such as encapsulation, and not as a security mechanism to obfuscate or secure sensitive data. It does not necessarily prevent access to a variable at runtime.

          You can use this keyword only in class definitions, not in interface definitions.