Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4170526
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:21:03+00:00 2026-05-21T00:21:03+00:00

one thing i’ve never really understood about AS3 is that you can’t have a

  • 0

one thing i’ve never really understood about AS3 is that you can’t have a private set method and a public get method together.

from within my class i would like to assign values that would call a private set function:

myNumber = 22;

but i need to pass that number as a parameter to a function

myNumber(22);

for example:

package
{
//Imports
import flash.display.Sprite

//Class
public class NumberClass extends Sprite
    {
    //Properties
    private var myNumberProperty:Number

    //Constructor
    public function NumberClass(myNumber:Number):void
        {
        this.myNumber = myNumber;

        init();
        }

    //Initialize
    private function init():void
        {
        trace(myNumber);
        }

    //My Number Setter
    private function set myNumber(value:Number):void
        {
        myNumberProperty = Math.max(0, Math.min(value, 100));
        }

    //My Number Getter
    public function get myNumber():Number
        {
        return myNumberProperty;
        }
    }
}

is there no way to use the set keyword on a private function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T00:21:04+00:00Added an answer on May 21, 2026 at 12:21 am

    The MXML compiler does not support getters and setters with mixed scopes/namespaces. There are a few tickets open regarding this:

    • https://bugs.adobe.com/jira/browse/ASL-44
    • https://bugs.adobe.com/jira/browse/SDK-25646
    • https://bugs.adobe.com/jira/browse/ASL-112.

    It’s quite annoying, but at least Adobe is aware of it. There is a way to accomplish mixed namespace getters and setters by using custom namespaces and fully-qualifying references to the getter or setter.

    package {
    
        use namespace my_namespace
    
        public class MyClass {
    
            private var _name:String;
    
            public function get name():String {
                return _name;
            }
    
            my_namespace function set name(value:String):void {
                _name = value;
            }
         }
    
         public class MySubClass extends MyClass {
    
           public function MySubClass(name:String) {
               super.my_namespace::name = name;
           }
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One thing I really like about AS3 over AS2 is how much more compile-time
One thing I really love about languages such as Python is that if you
One thing I have never truly understood is the concept of character encoding. The
One thing I don't like about writing javascript-based applications is that you have to
one thing that i always wondered, if i have a method like this: String
One thing I've never really understood is why in many libraries, constants are defined
One thing I really miss about Java is the tool support. FindBugs, Checkstyle and
One thing that's really been making life difficult in getting up to speed on
One thing that bugs me about IE is that when it goes to load
One thing that has bothered me about C# since its release was the lack

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.