Frage

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.

War es hilfreich?

Lösung

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;
    '
    '
    '
    '
    '
    '
}
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top