4 Replies Latest reply on Feb 5, 2007 7:31 PM by SymTsb

    Can you force the bg of a button to a spicific layer?

    bliesveld
      Ok, shot in the dark here? I am trying to get a button to always show the bottom layer as its background. For example:

      lets say I have 4 layers

      0: photo
      1: blue
      2: green
      3: yellow

      each layer is stacked on top of the next and each takes up 1/4 of the frame.

      [ 0 ][ 1 ][ 2 ][ 3 ]

      I have a button on each layer.

      I want the background of each button to show the section of the photo( on layer 0 ) it resides over.... so as the button moves you see the image under all the layers.

      Thanks
        • 1. Re: Can you force the bg of a button to a spicific layer?
          SymTsb Level 2
          Turn each layers contents into a movie clip. After that, you could use AS to turn off (hide) the mcs you don't want to appear. This is usually just a matter of myMC.enabled = false; and myMC._visible = false; for each MC you want to disappear. Does that make sense?
          • 2. Re: Can you force the bg of a button to a spicific layer?
            bliesveld Level 1
            ya, not what I am looking for... I want all the mc to still be there.... only the button to cut the the bottom of the stack and show the image.... for example if I only had 2 layers I could drop the alpha to 0% and see the layer under it... but I need to do this through all 3 layers to the image.

            Maybe I'm not describing the problem well enough?

            Layer: [ 0 ]
            Layer: [ 1 ]
            Layer: [ 2 ]
            Layer: [ 3 ]
            ^ button here that shows layer 0, + the button moves.
            • 3. Re: Can you force the bg of a button to a spicific layer?
              bliesveld Level 1
              after some reading it looks like this is what I am looking for:

              MovieClip.setMask

              any one have an idea how to use it?
              • 4. Re: Can you force the bg of a button to a spicific layer?
                SymTsb Level 2
                I think I may understand what you are trying to do now.... Let me put it in my own words to see that I really do...

                [Button1] [Button2] [Button3]

                Image is buried underneath all of these. When I rollover button1, the image underneath will show but all i'll see if the area of the image directly beneath it on the stage... This is definitely masking...

                If this is what you're after, here's what I'd do...

                Create another layer directly above the image. Create a new shape on the stage that is the size of the image you want to have show (probably the size of your buttons). Turn that shape into a movie clip and give it an instance name of mask. Select the layer this image is on and make it a mask (right click and select mask). This mask can be moved when you rollOver a given button...

                button1.onRollOver = moveMask(button1._x, button1._y);
                button2.onRollOver = moveMask(button2._x, button2._y);
                button3.onRollOver = moveMask(button3._x, button2._y);

                function moveMask(x:Number, y:Number):Void {
                mask._x = x;
                mask._y = y;
                }

                is this what you are after?