A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Hide object contained in parent, behind object contained in child

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    1

    Hide object contained in parent, behind object contained in child

    So, I have the following layering situation

    Stage

    --moveclip1

    --movieclip2
    ----movieclip3
    ------movieclip4

    I was wondering if it was possible for movieclip4 to be on top of movieclip1, even though movieclip1 is (and must remain) in a layer on top of movieclip2.

    This should happen when movieclip3 is being clicked (and movieclip4 shows up).

    I tried adding this to the mouseclick event of movieclip4:

    Code:
    this.parent.parent.addChild(event.currentTarget as DisplayObject);
    (I tried with and without "parent", and with different numbers of "parents"... cause I kind of lose counts of the parents there).

    but... it doesn't work.

    How do I solve this?

    thanks!

  2. #2
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    if the -- indicates nesting and the nesting must stay, then no, you cannot get movieclip4 on top of movieclip1 without placing movieclip2 above movieclip1

    you should reconsider your nesting situation, and probably place your code outside the buttons themselves.

    instead, place your mouse event listeners in the parents (or in this case, the stage, root timeline if your in the ide)


    if there is no nesting, you can do either
    movieclip.swapChildren()
    movieclip.setChildIndex()
    whichever is more appropriate (this works for the stage as well)
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


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