AS3 Question

Out of context: Reply #9

  • Started
  • Last post
  • 17 Responses
  • amullins0

    ok, so you've given all of them instance names... you may want to consider defining an array of looping through that directly.

    var arr:Array = [this.clip1, this.clip2, this.clip3, this.clip4];
    arr.forEach ( function(mc:*,index:uint,_arr:Ar... {
    mc.num = index;
    });

    you could also wrap the mcs in another mc and loop through the wrapper like:

    for (var i:uint = 0; i<wrapper.numChildren; i++) {
    wrapper.getChildAt(i).num = i;
    }

View thread