Author Topic: Layer order (z-index): Putting the book above the navigation buttons  (Read 1283 times)

Rotev

  • Newbie
  • *
  • Posts: 1
Hello,

Currently the navigation buttons generate after the book pages, and thus they are placed above the pages.
If I flip a page, the page will be under the navigation buttons, although I would like it to be placed above them.

How can I change the order of the navigation layer so that it will be placed bellow the book itself?

Thanks a lot,
Rotev


kopitejay

  • Support
  • Jr. Member
  • *****
  • Posts: 37
Re: Layer order (z-index): Putting the book above the navigation buttons
« Reply #1 on: March 09, 2009, 06:38:34 pm »
Hey Rotev

I normally use a function like this to swap the z-order of movieclips.
Code: [Select]
private function swapDepth(mc1, mc2):void
{
var a, b;

a = this.getChildIndex(mc1);
b = this.getChildIndex(mc2);

this.setChildIndex(mc1, b);
this.setChildIndex(mc2, a);
}

Pass in the names of the navigation and page container movieclips and it should swap the order.

Placing a call after the navigation bar has been set up might do the trick.

Cheers
Jay

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: Layer order (z-index): Putting the book above the navigation buttons
« Reply #2 on: March 11, 2009, 01:55:02 pm »
There's even a built-in function in AS3 to do that: swapChildren which does just that. :)

You might want to call that in the onLibraryComplete function in the MegaZine.as file, right after the addChild(_navigation); on line 1653 or so. Don't forget to recompile after the change, of course.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.