aneuryzm
aneuryzm

Reputation: 64834

FLEX: add stroke programmatically in Actionscript

how can I assign the stroke to my LineSeries, programmatically in Actionscript ?

<mx:LineSeries stroke="{new Stroke(0xCC33CC, 2)}"  />

How is it in Actionscript ?

LineSeries.stroke doesn't exist

thanks

Upvotes: 1

Views: 1446

Answers (2)

quoo
quoo

Reputation: 6307

The lineStroke "property" of a charting series, such as LineSeries is not actually a property but a style, therefore it needs to be set via either mxml, css, or a call to setStyle. So you could potentially call from actionscript:

myLineSeries.setStyle("lineStroke", myStroke);

However, it's best to limit your calls to setStyle() as it's an expensive call, so I'd try to use css or mxml if at all possible.

Upvotes: 1

Myk
Myk

Reputation: 6215

It would be something like this:

var s:Sprite = new Sprite();
s.graphics.lineStyle(2, 0xCC33CC); // define your line style
s.graphics.moveTo(new Point(whatever, whatever)); // move to origin
s.graphics.lineTo(new Point(whatever2, whatever2)); // draw line to target
s.graphics.lineStyle(); // this just clears the linestyle.

Look into the Graphics class for more information.

Upvotes: 0

Related Questions