Skip to main content
chienbleu
Known Participant
Feb 20, 2023 2:19 AM UTC
Question

how to order objects as3

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 is closed to new replies. Start a new post to keep the conversation going.

    6 replies

    kglad
    Community Expert
    Community Expert
    Feb 20, 2023 2:50 AM UTC

    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));

    }

    }

    }

    Translate
    chienbleu
    chienbleuAuthor
    Known Participant
    Feb 20, 2023 10:38 PM UTC

    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."

    Translate
    kglad
    Community Expert
    Community Expert
    Feb 20, 2023 10:43 PM UTC

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

    Translate