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

  • Home
  • SEARCH
  • 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 6567461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:20:20+00:00 2026-05-25T14:20:20+00:00

hi i have this really basic class here .. and i want to use

  • 0

hi i have this really basic class here .. and i want to use setter and getter functions but i cant access them here is my code

the class which is in a folder called classes and file name is ColorPicker.as

package classes {
    import flash.display.*;
    public class ColorPicker extends Sprite {
        private var _width:uint = 50;
        //private var _height:uint;
        private var BG:Shape = new Shape();

        public function ColorPicker ():void
        {
            BG.graphics.beginFill(0xFF0000);
            BG.graphics.drawRect(0, 0, 90, 90);
            BG.graphics.endFill();
            addChild(BG);

        }
        public function get Wd () :uint 
        {
            return _width; 

        }       
        public function set Wd ( h:Number) :void 
        {
            _width = h ; 

        }
    }

}

my code in time line

import classes.ColorPicker ; 
var cp:ColorPicker = new ColorPicker () ; 
trace(cp.Wd());

if i tried to access the function with out the get or the set i would have no problems .. could someone explain whats happening to me .. thanks in advance .

  • 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-25T14:20:21+00:00Added an answer on May 25, 2026 at 2:20 pm

    public function get Wd():uint declares a new property, not a function.

    You access properties similar to how you’d access an attribute:

    trace( cp.wd ); //will trace out the value
    cp.wd = 5;
    trace( cp.wd ); //should trace out 5
    

    *”CP” has an internet cultural meaning that is likely unintended, please try to use more descriptive variable names to avoid embarrassing situations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a really basic question but... I have some code like this var
I have read that you can do it, but would this really improve performance
I have seen this macro defined before but never really knew its purpose. Can
I realize that this is probably a very basic question, but I have spent
this is a really basic question - I have a model called Book, which
So I have this program that I really like, and it doesn't support Applescript.
I have this case <WrapPanel> <CheckBox>Really long name</CheckBox> <CheckBox>Short</CheckBox> <CheckBox>Longer again</CheckBox> <CheckBox>Foo</CheckBox> <Slider MinWidth=200
Ok I have this problem that I've never had before, it's really bugging me.
Really quick jQuery question... I have this function: $(document).ready(function() { $('a#show1').click(function() { $('.item1').toggle(1000); return
I have really no idea why I'm asking this as this a really completely

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.