How to fix overlapping objects on the stage in AS3

前端 未结 2 1067
旧巷少年郎
旧巷少年郎 2020-12-22 06:54

I have a flash game where I have a picture designed to be the textbox for a prompt and textbox inside with the relevant text but the textbox is being hidden by the image. A

2条回答
  •  余生分开走
    2020-12-22 07:38

    The order of adding display objects to display object containers effect their z-order, in other words the front to back order. The last added display object becomes the frontmost. So the child index of the children of a display object container is important for drawing of overlapped children.

    If you put picture and text on the same DisplayObjectContainer such as a MovieClip:

    Lets say your DisplayObjectContainer is mc.

    And your textbox is txt

    Please try this:

    mc.setChildIndex(txt, mc.numChildren-1);
    

提交回复
热议问题