A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] SwapDepths AS for Buttons?

  1. #1

    [F8] SwapDepths AS for Buttons?

    Hi -

    http://www.ijdesign.com/LBA/

    I have a movie that has a "Welcome" sub-menu that has four sub-menu buttons that each tell a certain MovieClip to play. Problem is, the movie clips all overlap eachother - and I can't figure out how to bring the MC that is associated with the clicked button to the front. So I am trying to setup my "Outside" button to move forward elements by using the SwapDepths AS on release. My problem is, it brings the MovieClip forward - even over top of my menu and logo, so I assigned all of the instances (buttons and MCs) with instance names, and call them in the code below. How can I code it not to go over those without assigning a specific number depth to every symbol? Or is that the proper way to do it? It isn't working properly, and I'm stuck at how to make it work. Any ideas? I've uploaded the Flash file for review, if it helps, to: http://www.ijdesign.com/LBA/LBARealty-Demo5.fla - it is 3.32MB.

    on (release) {

    this.welcomebtn.swapDepths(99);
    this.outsidebtn.swapDepths(98);
    this.insidebtn.swapDepths(97);
    this.officesbtn.swapDepths(96);
    this.environbtn.swapDepths(95);
    this.line1.swapDepths(94);
    this.line2.swapDepths(93);

    this.bar.swapDepths(92);
    this.whitebox.swapDepths(91);

    this.denverplace.swapDepths(90);
    this.blend.swapDepths(89);

    this.outsidetext.swapDepths(88);
    this.outside.swapDepths(87);

    this.welcomephoto.swapDepths(86);
    this.welcometext.swapDepths(85);
    this.insidephoto.swapDepths(84);
    this.insidetext.swapDepths(83);
    this.officestext.swapDepths(82);

    //Movieclip GotoAndPlay Behavior
    this.outsidetext.gotoAndPlay("2");
    //End Behavior

    //Movieclip GotoAndPlay Behavior
    this.outside.gotoAndPlay("2");
    //End Behavior


    }
    Last edited by Idelle; 03-06-2008 at 12:03 PM.

  2. #2
    Junior Member
    Join Date
    May 2005
    Location
    Toronto, Ontario, Canada
    Posts
    8
    All I can suggest is setting up a function to run at the everytime a new page is run that reorders everything.

    And maybe using getNextHighestDepth() insead of assigning specific number to each layer...

    this way you just have to do this.. (I just used example names)


    PHP Code:
    function updateAssetDepth() {
        
    // position all assests
        
    mc_bg_ani.swapDepths(getNextHighestDepth());
        
    mc_content.swapDepths(getNextHighestDepth());
        
    mc_nav_area.swapDepths(getNextHighestDepth());

    I do things like this at the start of the movie and everytime a new page is loaded into my main container.

    This ensures that my mc_nav_area is always on top. By doing it this way you just order the items as they should appear... first item is on the bottom and last item is on the top. Makes it a little simpler if you have to add another item into the mix.

    Hope that helps.
    I wish I could have opened up your fla for more details but I only have MX04 at the office yes its sad, I know.
    no worries
    - MM

    "In the realms Unseen, Lives are cruelly governed by Zeroes and Ones."

  3. #3
    How do I do this with multiple MovieClips? I have four buttons that are within the Welcome sub menu -- each of the four buttons opens up a movieclip that has a masked revealed image and text. Let's say I click on "Inside" button - it will open the Inside's MovieClip. Then when I click on the "Outside" button, I want it to open the Outside button's MovieClip on top of (any) of the other buttons' called MCs. Does this make sense? With the swapDepths, it seems I can only do that with one other instance... am I not understanding this correctly?

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