7 Replies Latest reply on Dec 20, 2007 9:31 AM by kglad

    Invisible Layers

    Rick_Cope Level 1

      I am using Flash 8 and am trying to get selected layers (or even better, layer folders) to become invisible when the user presses a button. Alas, no joy so far. I've tried the code suggested in the help files but whatever I do nothing seems to happen. Any ideas anyone?
        • 1. Re: Invisible Layers
          kglad Adobe Community Professional & MVP
          you can't control layers with actionscript. layers don't even exist in your swf.
          • 2. Re: Invisible Layers
            Rick_Cope Level 1
            Thanks kglad. I must have misunderstood the help stuff. What do you reckon this code is designed to do then?
            fl.getDocumentDOM().getTimeline().layers(0).visible = false;
            It say its will make the first layer invisible. Is this correct?
            • 3. Re: Invisible Layers
              kglad Adobe Community Professional & MVP
              that's jsfl code. it will not affect anything your the file in which it appears. you can use that code in a file that affects other fla files. if you do that, the affected file will be permanently changed. in particular, you cannot turn layer visibility on and off during runtime.
              • 4. Re: Invisible Layers
                Rick_Cope Level 1
                Thanks kglad. That puts paid to that idea! Ho hum.
                Try this one... can I make the objects on the layer I'm trying to work with invisible? The problem is that they are initially created as graphic objects then animated using motion tweens. I've tried setting the 'visible' property of the original graphic to false using actionscript but that seems to have no effect. Is it because they are now tweens? Can I access the tween or the original object in it and turn off the visibility? Am I on a loser with this one? Would masking in some way work? Any advice gratefully received!
                • 5. Re: Invisible Layers
                  kglad Adobe Community Professional & MVP
                  you can't control a graphic with actionscript.

                  you could create a movieclip that would "cover" one (or more) of your graphic animations (by adding shapes to the movieclip that are the same color as the stage). by controlling the _visible property of that movieclip you could control whether your graphic animation is visible.
                  • 6. Re: Invisible Layers
                    Rick_Cope Level 1
                    Thanks for the tip kglad. I'll give it a go. Trouble is I've got a LOAD of objects on each layer. It could be a real pig to cover them all with movie clips and animate the lot to keep pace with them as they move. Anyway, I'll try it and see what happens. Thanks for your help.
                    • 7. Re: Invisible Layers
                      kglad Adobe Community Professional & MVP
                      you're welcome. (and, in future projects, there's very little reason to use buttons or graphic objects. using movieclips gives you much more flexibility.)