You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Tintin <19...@googlemail.com> on 2013/09/06 22:11:44 UTC

Masking an Image

Hello

I am struggling to display a moving image within a clipping mask. Let me
summarise my setup.

I have an MXML Component which is a Spark Image within a parent group. The
'y' property is bound to a changing value driving the image up and down the
screen.

I am trying to define a rectangular Clipping Mask, either in ActionScript or
within the MXML, which will provide a static 'hole' from which I want to
view the image moving up and down within.

Can anyone suggest how I could approach this please.

Regards

Chris



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Masking-an-Image-tp2610.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Masking an Image

Posted by Tintin <19...@googlemail.com>.
To anyone with a similar problem I have finally figured it out.

First create a shape which defines the clipping mask area. In my instance I
created a separate MXML component as I wanted to use it to mask several
images:



The colour of the fill is not important as it will be ignored eventually.

Once your clipping mask shape is in place give it an 'id' so that you can
reference it in your image. Finally bind the 'Mask' property of your image
to your new clipping mask object as follows:



I hope this helps.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Masking-an-Image-tp2610p2612.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.