Combine Text with a Draggable Mask AS3.0
- by RC
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();
}