A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: control layers with actionscript

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    12

    control layers with actionscript

    I was wondering if there is a actionscript I can attach to a button for turning layers on and off in the main timeline. I have a task that would be much easier if I could just turn a layer on or off using a button. thanks, edley

  2. #2
    Senior Member
    Join Date
    Jan 2010
    Location
    England
    Posts
    268
    you could use getnexthighestdepth but it might not always be suitable for what your asking. hmmm..from what your saying you want a button to swap around layers..and the only reason you'd want to do that is to make things either appear or dissapear im guessing.. why not add this instead:

    Code:
    buttonname.onRelease = function() {
    objectname._visible = false;
    and
    Code:
    buttonname.onRelease = function() {
    objectname._visible = true;
    you get the same effect (paste into main timeline)
    by using the _visible code just add multiple lines to turn off everything in the same layer.
    for example you have three objects in one layer and one object in another. you would have:
    button1.onRelease = function () {
    objectone._visible = false;
    objecttwo._visible = false;
    objectthree._visible = false;
    }
    this would just leave the fourth object on screen.
    reverse this if you want the opposite effect to turn them back on.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center