AS3: declaring variables in a for loop
AS3: declaring variables in a for loop
Out of context: Reply #4
- Started
- Last post
- 23 Responses
- Pupsipu0
haha yea you can't create variable names on the fly. You have to name it mainBtn in this case and stick it into an array with an index, or a dictionary with a key.
and you can't put private/public in front of a var you're declaring inside a function. That stuff is only for vars outside of functions, and loops are functions and are usually inside named functions.
also in your example, you would say var mainBtn:MainBtn = new MainBtn();
you really need to look up some tutorials, you're fucking lost.