Skip to main content
chienbleu
Known Participant
February 20, 2023
Question

how to order objects as3

  • February 20, 2023
  • 1 reply
  • 657 views

i wanna know how you can go through all the objects and base their z index/layer on their y position. i don't know how to go about doing this

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    February 20, 2023

    function childrenF(dobj:DisplayObject):void{
    // do whatever with dobj

    if(dobj is MovieClip){ // do use graphic symbols?
    for(var i=0;i<dobj.numChildren;i++){
    childrenF(dobj.getChildAt(i));

    }

    }

    }

    chienbleu
    chienbleuAuthor
    Known Participant
    February 20, 2023

    it's  saying that getchildat and numchildren are undefined

    "Call to a possibly undefined method getChildAt through a reference with static type flash.display:DisplayObject."  "Access of possibly undefined property numChildren through a reference with static type flash.display:DisplayObject."

    kglad
    Community Expert
    Community Expert
    February 20, 2023

    cast dobj as a movieclip (or displayobjectcontainer) in the for-loop