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
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
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.