Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

Flex Databind to Lineseries

I'm creating lineseries using below code
var myLineSeries:LineSeries = new LineSeries();
myLineSeries.visible = allSegmentChartsOn;

I want the visible should be driven from allSegmentChartsOn boolean which is bindiable variable.
defined as :
[Bindable] private var allSegmentChartsOn:Boolean=true;

is there anyway I need to do in order the visibility should be changed as we change allSegmentChartsOn  variable in the code?
[Bindable] private var allSegmentChartsOn:Boolean=true;
var myLineSeries:LineSeries = new LineSeries();
myLineSeries.visible = allSegmentChartsOn;

Open in new window

0
SimonHowald
Asked:
SimonHowald
  • 2
  • 2
1 Solution
 
SimonHowaldAuthor Commented:
any one?
0
 
zzynxSoftware engineerCommented:
private var allSegmentChartsOn:Boolean=true;

[Bindable]      
public function set segmentChartsOn(value:Boolean):void {
   allSegmentChartsOn = value;
}
public function get segmentChartsOn():Boolean {
   return allSegmentChartsOn;
}

var myLineSeries:LineSeries = new LineSeries();
myLineSeries.visible = allSegmentChartsOn;

>> is there anyway I need to do in order the visibility should be changed as we change allSegmentChartsOn  variable in the code?
// Yes. This line takes care of that:

BindingUtils.bindProperty(myLineSeries, "visible", this, "segmentChartsOn");

The above line adapts the "visible" property of myLineSeries whenever the "segmentChartsOn" property of 'this' changes.
0
 
SimonHowaldAuthor Commented:
You are a real Flex master!

Thanks!
0
 
zzynxSoftware engineerCommented:
Thanx 4 axxepting
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now