« Simple modal window in ActionScript
» RIA Developer Camp

ActionScript, Flex 2

Adding a mask to graphic components

Andrei Ionescu | 29.10.07 | Comment?

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.

Share and Enjoy:
  • Technorati
  • StumbleUpon
  • del.icio.us
  • NewsVine
  • Reddit
  • Digg
  • Furl
  • co.mments
  • blogmarks
  • Slashdot
  • description
  • Taggly
  • YahooMyWeb
  • connotea
  • Webride




Tags: , , ,

This post was written by Andrei Ionescu

Views: 1680

related

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

:

:


« Simple modal window in ActionScript
» RIA Developer Camp