# Problems with setter/getter in AS 3.0

**URL:** <https://forum.kirupa.com/t/problems-with-setter-getter-in-as-3-0/239669>\
**Category:** Uncategorized\
**Created:** [September 24, 2007, 5:56pm UTC](https://forum.kirupa.com/t/problems-with-setter-getter-in-as-3-0/239669 "2007-09-24T17:56:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenji](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kenji](https://forum.kirupa.com/u/kenji)\
**Post date:** [September 24, 2007, 5:56pm UTC](https://forum.kirupa.com/t/problems-with-setter-getter-in-as-3-0/239669/1 "2007-09-24T17:56:41Z")

</div>

hi everyone

i’m trying to convert an AS 2.0 component to an AS 3.0 component but i’m having some problems with getter and setter methods.

here is something similar to what i’m trying to do:

this component has only one variable, \_path. in the component inspector i give my variable the value “myFile”

the AS 2.0 component is working fine

```auto
class as2Class extends MovieClip{
            
    private var _path:String;
    
    [Inspectable(defaultValue="", type=String, name="file path")]
    public function set path(value:String):Void{
        _path = value;
        trace("set")
    }
    public function get path():String{
        return _path;
    }
    public function as2Class(){
        trace(_path);
        trace("constructor")
    }
}

```

if i test the component in the output panel i get :  
set  
myFile  
constructor

but the AS 3.0 component isn’t working

```auto
package{
    import flash.display.MovieClip;
    
    public class as3Class extends MovieClip{
            
        private var _path:String;
    
        [Inspectable(defaultValue="", type=String, name="file path")]
        public function set path(value:String):void{
            _path = value;
            trace("set")
        }
        public function get path():String{
            return _path;
        }
        public function as3Class(){
            trace(_path);
            trace("constructor")
        }
    }
}

```

if i test this component, in the output panel i get:  
null  
constructor  
set

am i doing something wrong or it is a bug?

Thank you.
