Log in

View Full Version : drag movieclip as a mask



evan
08-28-2008, 06:44 AM
--If I use conventional startDrag(); and stopDrag(); with an mc it will work unless I make the layer the movieclip sits on into a mask -then my movieclip won't respond.

I did find a workaround -by using the caurina transition I can have the tweened object follow the mousex/mousey set the timer to .1 and apply the mask and I can get the effect I want.

..but it's still bugging me why that first method doesn't work.
If I animated any object using the old timeline way -I can do a nice wipe effect. But it doesn't work with startDrag(); ......wierd.

Medyman
08-28-2008, 01:14 PM
How were you writing the ActionScript? Once you use a MovieClip as a mask, it disappears from the display list. It can't take direct mouse events.

So, you have to set the mouse events via a listener on whatever is being masked.

evan
08-28-2008, 05:38 PM
hole.addEventListener(MouseEvent.MOUSE_DOWN,drag);
hole.addEventListener(MouseEvent.MOUSE_UP,leaveit);
function drag(evt:MouseEvent):void
{
hole.startDrag();
}
function leaveit(evt:MouseEvent):void
{
hole.stopDrag();
}

hole is an mc that is on the masked layer -it's unresponsive once I apply a mask.

Medyman
09-02-2008, 02:02 AM
Right...like I said, a mask isn't in the displayList and therefore can't recieve mouseEvents.

If you want to manipulate hole, you'll have to set a listener on w/e hole is masking.

evan
09-02-2008, 04:51 AM
do you mean a transparent movieclip that would move with it?

I'm thinking about how sniper type games work and doing banners that have a moving spotlight

-I can use the tweener and assign it to "hole" and it works but I was wondering how the conventional way to do it was.

Medyman
09-02-2008, 12:46 PM
Hmm...
I think we're misunderstanding each other. Below is an example of how you would tween a mask over a movieclip. I _think_ this is what you meant. Let me know if you're trying to do something else.

AS3: Dragging a Mask (http://www.mediafire.com/?sharekey=6169ea60d5f47fced2db6fb9a8902bda)
The mask-er MC is in the shape of a circle.

evan
09-02-2008, 03:59 PM
yep, that's it.