25 Replies Latest reply on Jun 7, 2007 8:34 AM by kglad

    AS3 addChild() to what????

    Rothrock Level 5
      I'm trying to figure out this new DisplayObject list and stuff. I wanted to make some random boxes and put them on the stage – which works great. Then I decided I would like to drag them around – again no problem. Then I decided I would like the one I clicked on to come to the front – big problem.

      I'm really wondering when I do something like addChild(sprite) or what ever, what am I adding to it to? I thought it was stage, but that isn't it. Evidently after a loooonnggg time of trying to understand the help files, I figured out that it was the

      [object MainTimeline]

      Whatever that was. And that I could use "this" in my click handler because they happened to be the same scope. But I imagine at some point they won't be the same. So how do I reference [object MainTimeline].

      I guess it is the same issue as AS2 with root and that I could use:

      var home=this;

      And then later use:

      home.setChildIndex(event.target,home.numChildren-1);

      Mostly I think typing this up has helped me work out a lot of this. But if anybody has any pointers, please share.