How can I create dynamic variable in ActionScript?
Example code:
import windows.nwindow;
for(var num:int = 0; num< 2; num++)
{
this["nWin"+num] = new nwindow();
this["nWin"+num].width = 320;
this["nWin"+num].height = 200;
this["nWin"+num].title="window" + num;
this["nWin"+num].open();
}
When I run the above code it dispatch this error:
Error #1056: Cannot create property nWin0 on MultiWindow.
So, how can I use dynamic variable for this case here?
you can use a dictionary to achieve this. eg-