One option is to wrap the graphics object that you are going through and add getters and setters for individual properties that are otherwise only available as parameters.
Pseudo Code:
public class CustomGraphics
{
protected var _graphics:Graphics;
protected var _lineColor:uint;
protected var _lineThickness:int;
protected var _lineAlpha:Number;
public function CustomGraphics( gfx:Graphics )
{
_graphics = gfx;
_lineColor = 0;
_lineThickness = 1;
_lineAlpha = 1;
draw();
}
public function set lineAlpha( value:Number ):void
{
if( _lineAlpha != value ) {
_lineAlpha = value;
draw();
}
}
public function draw():void {
_graphics.setLineStyle( _lineThickness, _lineColor, _lineAlpha );
}
}
source
share