A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Can anyone explain or help me with stacking order (layers) in AS3

Hybrid View

  1. #1
    Member
    Join Date
    Jul 2008
    Location
    Manhattan, New York City. (New York City??)
    Posts
    38

    Question Can anyone explain or help me with stacking order (layers) in AS3

    I am trying to set the depth of the of the movie clip that I created in AS3.

    Basically I want the movie clip to be at the bottom of the stacking order. And it keeps appearing on top of my design or items I placed in the timeline


    how can I make it so this object or movie clip is at the bottom or if I wanted to bring it to a different level?

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Whenever you use addChild, the object is put on the top of the display list (highest z-index). You can use a couple different methods to manually set the index - also, remember that you have to use an index thats in bounds, you can only set an index to 100 if there are 100 other things on stage.

    addChildAt(mc, 0); <= this will add to the back

    addChildAt(mc, 10); <= this will add to layer 10 and bump anything already there

    setChildIndex(mc, 20); <= this moves mc to index 20, bumping anything else

    setChildIndex(mc, this.numChildren - 1); <= bring mc to the top

    swapChildren(mc, mc2); <= switches the two

    swapChildrenAt(0, 10); <= switches whatever is at 0 with whatever is at 10

  3. #3
    Member
    Join Date
    Jul 2008
    Location
    Manhattan, New York City. (New York City??)
    Posts
    38

    Thumbs up Thanks

    This cleared things up.. thanks. I saved this code.. I am sure I will be using it often now. Thanks again

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