addEventlistener, array, as linkage


i have added 10 movieclips linkage "box" in function. i've named different instances "layer1" "layer10"

 

my question is, how can 1 add eventlistener to, lets say, "layer4"?

 

 

var num_boxes:int = 10;

var box_spacing:int = 1;

 

var _boxes:array = [];

 

function test()

                    {

                              for (var i:int = 0; < num_boxes; i++)

                              {

                                        var box:box = new box( + 1 );

                                        box.y = (box.height + box_spacing) * i;

                                        box.name= "layer" +( + 1);

                                        box.buttonmode = true;

                                        box.addeventlistener( mouseevent.mouse_down, onboxpress );

                                        box.addeventlistener( mouseevent.mouse_up, onboxrelease );

 

 

                                        addchild( box );

                                        _boxes.push( box );

                              }

you put in conditional checks if  " " == 3 , when add event listener current box



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

how to devide a circle into equal parts

"Could not fill because there are not enough opaque source pixels" - not solved by any other thread

Why can't I change the billing info for my account?