Results 1 to 7 of 7

Thread: drag movieclip as a mask

  1. #1
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default drag movieclip as a mask

    --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.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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.

  3. #3
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default

    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.
    Last edited by evan; 08-28-2008 at 09:52 PM.

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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.

  5. The Following User Says Thank You to Medyman For This Useful Post:

    evan (09-02-2008)

  6. #5
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default

    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.

  7. #6
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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
    The mask-er MC is in the shape of a circle.

  8. The Following User Says Thank You to Medyman For This Useful Post:

    evan (09-02-2008)

  9. #7
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default

    yep, that's it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •