1

I am using Adobe Flash Builder 4.6 and trying to create, add and addEventListener to objects that i created dynamically, in as2 i was doing it by:

for(i=0;i<10;i++){
    abc[i]doSomeThing;
}

How it is in actionScript 3? I searched it much and found nothing, so any help would be greatly appreciated.

2

1 Answer 1

0

you have to use AS3.0 in flash

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

  abc[i].addEventListener(MouseEvent.CLICK,doSomeThing);

}

 function doSomeThing(event:MouseEvent):void
{
   switch(event.target)
{
    case abc[0]:
    //statements for object 1;
    break;
    case abc[1]:
    //statements for object 2;
    break;
    '
    '
    '
    '
    '
    '
}
}
2
  • thanks for your help, but the point i didn't get; how can i create and add -for example textinputs- items Nov 4, 2012 at 18:05
  • i mean how can i create a text input inside of a for loop and addItem to a panel container like, panel.addItem(abc[i]); Nov 4, 2012 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.