Hi, I have a question about AS3 I couldn’t find any answers.
I’d be glad if you could help me.
I can only explain this by an example; so:
I have 2 classes and one of them includes the other as a getter/setter property:
public class First {
private var _X:Number = 0;
public function get X():Number {
return _X;
}
public function set X(value:Number):void {
_X = value;
}
// some other properties here...
public function First(x:Number) {
this.X = x;
}
}
public class Second {
private var _first:First = new First(0, 0);
public function get first():First {
return _first;
}
public function set first(value:First):void {
_first = value;
ExpectedMethod();
}
public function Second() {}
}
var second:Second = new Second();
//When I execute the following code:
second.first = new First(1, 1); //ExpectedMethod() is fired which is ok.
//I need the following code to return the same result:
second.first.X = 1; //but it does not. ( ExpectedMethod() is NOT fired. )
I know why…
but is there a way to tweak this code to get what I want?