a question on Bindable in Flex
I have a class called which is called ChartInfo,and it has a getter and setter methods as:
[Bindable]
public function set isShowingPower(b:Boolean):void
{
_isShowingPower = b;
hasChanged();
}
public function get isShowingPower():Boolean
{
return _isShowingPower;
}
The _isShowingPower i开发者_如何学Pythons the property.
However,if I want to set the _isShowingPower from another class:
_chartInfo.isShowingPower(false)
It will always give error like: 1195: Attempted access of inaccessible method isShowingPower through a reference with static type components.charting:ChartInfo.
Could anyone give an idea?Thanks a lot.
to access a setter and/or getter you have to do it like a var.
in your case it should be
_chartInfo.isShowingPower = false;
Setters are used like properties, so _chartInfo.isShowingPower = false;
精彩评论