DraconicArchmage
Programmer
I'm stuck. Yes, you probably already knew that, but this is my last resort.
I'm making a program that has several sprites move and colide using vecotrs and physics and such, and I'm doing it in flash, as it will be part of a website. I'm relatively new to flash, but not new to programming. However, it seems "ActionScript" is very confusing and hard to use.
The question I am asking is how do I create an array of objects? I have nearly everything I need, but I need to be able to create another instance of that object via code, and control it via code. So far, I have objects of "obj01", named "obj01", "obj02", "obj03" and "obj04". I did this very similarly to the Flash 5 sample "Circular motion".
Now, I need to be able to refer to the objects through code, so I don't have to copy and paste and replace numbers. The way this is usually done is an array. How do I get from typing
obj01._blah = Blah
obj02._blah = Blah
to
for(IntA = 1; IntA <= ObjectCount; IntA++){
obj[IntA]._blah = Blah
}
?
I really need to do this, and to be able to create more objects later on. Any help or advice is greatly appreciated, and I will give credit to those who actually have helped quite a bit. In case the e-mail notification bit doesn't work, my e-mail is brian@embergamedev.f2s.com . Thank you for your time and patience.
P.S. Mind that I'm still fairly new, so the more explaination on what things are and do, the better.
I'm making a program that has several sprites move and colide using vecotrs and physics and such, and I'm doing it in flash, as it will be part of a website. I'm relatively new to flash, but not new to programming. However, it seems "ActionScript" is very confusing and hard to use.
The question I am asking is how do I create an array of objects? I have nearly everything I need, but I need to be able to create another instance of that object via code, and control it via code. So far, I have objects of "obj01", named "obj01", "obj02", "obj03" and "obj04". I did this very similarly to the Flash 5 sample "Circular motion".
Now, I need to be able to refer to the objects through code, so I don't have to copy and paste and replace numbers. The way this is usually done is an array. How do I get from typing
obj01._blah = Blah
obj02._blah = Blah
to
for(IntA = 1; IntA <= ObjectCount; IntA++){
obj[IntA]._blah = Blah
}
?
I really need to do this, and to be able to create more objects later on. Any help or advice is greatly appreciated, and I will give credit to those who actually have helped quite a bit. In case the e-mail notification bit doesn't work, my e-mail is brian@embergamedev.f2s.com . Thank you for your time and patience.
P.S. Mind that I'm still fairly new, so the more explaination on what things are and do, the better.