Kevin
Kevin

Reputation: 6833

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

Upvotes: 1

Views: 170

Answers (2)

Gus
Gus

Reputation: 718

to access a setter and/or getter you have to do it like a var.

in your case it should be

_chartInfo.isShowingPower = false;

Upvotes: 5

adamcodes
adamcodes

Reputation: 1606

Setters are used like properties, so _chartInfo.isShowingPower = false;

Upvotes: 3

Related Questions