Hi,
I’d like to set a gradient mask to one of my Views, but it doesn’t work.
Here is the code :
private function onMirrorAdded(pEvt:Event):void
{
this._mirrorView.removeEventListener(Event.ADDED_TO_STAGE,onMirrorAdded);
this._alphaGradient=new Sprite;
this._mirrorView.cacheAsBitmap=true;
this._alphaGradient.cacheAsBitmap=true;
this._alphaGradient.graphics.beginGradientFill(GradientType.LINEAR,[0x00FF00, 0x000088],[1,0],[0, 255]);
this._alphaGradient.graphics.drawRect(0,0,200,200);
this._alphaGradient.rotation = Math.PI/2;
this._alphaGradient.x=-this._alphaGradient.width/2+this._mirrorView.x;
this._alphaGradient.y=+this._mirrorView.y;
addChild(this._alphaGradient);
this._mirrorView.mask=this._alphaGradient;
}
Am I missing something ? Does this need an extra update function ?
Thanks.