A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Depth in AS3

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    24

    Depth in AS3

    I am using AS3. I have two instances on stage on the same spot. One of them is called "shape1" and it is on top of the other one. How can I change depth using AS, so that shape1 is under the other instance.

    Any help would be appreciated.

  2. #2
    Senior Member
    Join Date
    Oct 2005
    Posts
    148
    Several ways to do this, but if you just want to overlap shape1 and shape2 movieclips, then you can use swapChildren to swap the depths.
    Actionscript Code:
    this.swapChildren(shape1, shape2);

    You can read more about change depths in this article:
    http://www.adobe.com/devnet/flash/qu...mming_as3.html

  3. #3
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    swapChildren is fastest. If you have more than two shapes and you're managing their depths then you'll want to use something like setChildIndex and get the top value using numChildren
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  4. #4
    Junior Member
    Join Date
    Oct 2010
    Posts
    24
    Thanks that solved it.

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