Combine Text with a Draggable Mask AS3.0

Posted by RC on Stack Overflow See other posts from Stack Overflow or by RC
Published on 2010-04-01T19:18:55Z Indexed on 2010/04/06 6:23 UTC
Read the original article Hit count: 432

Filed under:
|
|

So I have an image that is the size of the stage: img_mc. Then I drew a small rectangle: mask_mc.

The idea is to make a "window" of the small rectangle, view img_mc through the window, and be able to drag the window around.

The following code works fine but I want to add text to the mask - "Drag Me!" or whatever. But if I group text with the mask it breaks down. If I make a separate text_mc I can drag it around but it's not part of the mask. How can I combine text with a mask?

(sorry if this question is pathetically easy!)

Thanks for any thoughts you can share!

img_mc.mask = mask_mc;

mask_mc.buttonMode = true;

img_mc.cacheAsBitmap = true; //because I blurred the mask

text_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragF); mask_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragF); stage.addEventListener(MouseEvent.MOUSE_UP, dropF);

function dragF(event:MouseEvent):void{

mask_mc.startDrag();

}

function dropF(event:MouseEvent):void{

mask_mc.stopDrag();

}

© Stack Overflow or respective owner

Related posts about as3

Related posts about draggable