Recently I had to put a mask to an UIComponent. Here is the way to do it:
var largeMask:UIComponent = new UIComponent(); largeMask.graphics.beginFill(0x00FFFF, 0.5); largeMask.graphics.drawRect(0, 0, 120, 40); largeMask.graphics.endFill(); largeMask.x = 0; largeMask.y = 0; this.addChild(largeMask); this.mask = largeMask;
this should be UIComponent or Shape or similar object.
Obs: the mask must be added as child to the object you need to add the mask otherwise everything will be masked – nothing will be shown.
Tags: ActionScript, flex, mask, UIComponent
This post was written by Andrei Ionescu
Views: 7885









the mask must be added as child to the object
thx, andrei. you saved my night!
You’re the man. This is precisely what I wanted to know!
Andrei, you point it out exactly – I was wondering why I couldn’t mask anything in memory, it was just because I did not made an addchild call. Thanks man, this hunted me 3 days!