8 Replies Latest reply: Apr 9, 2013 5:53 AM by moccamaximum RSS

    Mask containing movie clips

    LordMysterious Community Member

      Hey guys

       

      I am creating a 'shimmer' effect over an object using a mask as follows:

       

      Layer 1: Mask

      Layer 2: Shimmer effect using a motion tween

      Layer 3: Object that has the shimmer effect applied to it

       

      The mask layer comprises three drawing objects and the shimmer effect behaves exactly as it should i.e. applies only where the drawing objects are.

       

      However, I also have five movie clips on the stage that I want the shimmer effect applied to - but not when the movie clip has been clicked. So the answer is simple, create five instances of said movie clip in the mask, and when the instance on the stage is clicked, set the visible property of the instance in the mask to false, or use removeChild...

       

      No.

       

      Whenever I add instances of the movie clip to the mask, the shimmer effect is not applied to them, yet if I break them apart and use them as drawing objects, they work just fine (but obviously drawing objects can't be animated using AS).

       

      My question is - is this even possible, and if so, how would I go about doing it?

       

      Thanks in advance

        • 1. Re: Mask containing movie clips
          moccamaximum Community Member

          dont mix up drawingObjects and MovieClips in your mask.

          convert the 3 drawing objects to a MovieClip and then add your other movieClips inside that MovieClip.

          • 2. Re: Mask containing movie clips
            LordMysterious Community Member

            That didn't work - I should explain the drawing objects are shape outlines - a smaller shape placed on top of a larger shape then deleted, leaving the outline, with transparency in the middle.

             

            If I place these drawing objects in a MovieClip, the shimmer is applied to the *whole* MovieClip, not just to the are the drawing objects are masking.

            • 3. Re: Mask containing movie clips
              LordMysterious Community Member

              As a picture paints a thousand words:

               

              mvc.jpg

               

              The frames are flat blue, the 'shimmer' is passing over the frames, which are drawing objects, yet is not applied to the green boxes, which are movie clips.

               

              drawingobj.jpg

               

              The green boxes are now drawing objects as opposed to movie clips, the mask is working perfectly - however I need to be able to remove the boxes using AS when its counterpart on the stage is clicked.

              • 4. Re: Mask containing movie clips
                moccamaximum Community Member

                set your mask not directly on the stage but with actionscript.

                make a movieclip _maskee that contains all your squares (every single one a movieclip) and combine all your "outlines" into one movieclip called outlines.

                convert your tween also in a movieclip and try this:

                _mask.cacheAsBitmap = true;

                _maskee.cacheAsBitmap = true;

                _maskee.mask = true;

                 

                these three lines have to be called every time you change the contents of your masked objects (remove one of them or make one invisible)

                • 5. Re: Mask containing movie clips
                  LordMysterious Community Member

                  Hmm, I don't understand, I've not used masks very often.

                   

                  Right, so I should create two MovieClips on the stage, one called "outlines", which contains the outlines and another one which contains the squares - what should the instance name for this be?

                   

                  Okay, there are now two MovieClips on the stage on the 'mask' layer.

                   

                  You say to set the mask using AS... okay, but I have two MovieClips and it's not possible to have multiple masks... is it?

                   

                  The object being tweened is already in a MovieClip.

                   

                  I don't understand where I call those lines, _mask, _maskee, what should the instance names be?

                   

                  I'm sorry, until recently masking was something I'd only heard about 'in theory'

                  • 6. Re: Mask containing movie clips
                    moccamaximum Community Member

                    put outlines and all the squares in one new movieclip and call that movieclip "_mask",

                    if your motion twenn with the shimmer effect is already in a movieclip call that movieclip "_mask"

                     

                    then use this three lines:

                    _mask.cacheAsBitmap = true;

                    _maskee.cacheAsBitmap = true;

                    _maskee.mask = _mask;

                     

                    to "actionscript" your mask

                    for this to work _mask and _maskee have to live in "normal" layers (that are neither a mask nor a masked layer)

                     

                    to illustrate the difference:

                     

                    this is how an uncached mask treats complex (nested objects/your problem):

                    uncachedMask.PNG

                    this is how a cached mask treats complex (nested objects/your solution):

                    cachedMask.PNG

                    The timeline looks like this:

                    cachedMaskTimeline.PNG

                    • 7. Re: Mask containing movie clips
                      LordMysterious Community Member

                      That worked brilliantly, thanks for your patience

                      • 8. Re: Mask containing movie clips
                        moccamaximum Community Member

                        You`re welcome ;-)