A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: When using property attributes and class and variables

  1. #1
    Junior Member
    Join Date
    Apr 2014

    Exclamation When using property attributes and class and variables

    I am somewhat confused with the attributes of class properties and variables
    for example when not using a varible with a public or private internal classes as concepts or functions here I got, I could explain with some simple examples to visualize it better thanks!

    at what point should I use a variable: private, public, protect, internal
    how to use the attributes of a class as: internal, private, protected, public, static
    so please explain me with some examples in order to understand

    Access control attributes to variables:
    public: available to any call
    private: available only to the class that defines
    protect: available only to the class that defines and subclasses of that class
    internal: cauqluier available for call within the same package

    Class property attributes:
    internal (default): Visible to references inside the same package.
    private: Visible to references in the same class.
    protected: Visible to references in the same class and derived classes.
    public: Visible to references everywhere.
    static: Specifies that an object belongs to the class rather than to the instances of the class.
    UserDefinedNamespace: Name space for custom user-defined names.

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Until you get into oop or higher level programming...

    Just make everything private.

    Use only one class per package to start. Name your main class Main. Save Main.as with your swf. It's the top level just like your stage.

    To use subclasses, just create a new actionscript class and save it with Main.as (MyButton.as for example). Then in Main, you can add your class like this:
    private var mcButton:MyButton = new MyButton();

    Then call methods (functions) in mcButton like this from Main:

    So MyButton is a child of Main. mcButton would have to call parent to get to main.

    Is that what you mean?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center