|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
array of classes
I wanna make an array of classes and then access those classes through the array.
myArray = ["first","second"]; trace(myArray[0]); // first theName = "first"; _root.attachMovie("theSymbol",theName, 100); first.someFunction(); // this works // I found that You can't do this: theName.someFunction(); // Here, it thinks that 'theName' is an object; I want to use it's value instead. // this doesn't work either myArray[0].someFunction(); how can I make an array of classes u
__________________
Some day I'll create a smart quote to put here. |
|
#2
|
||||
|
||||
|
Figured out a way. Don't know if it's the best but here it goes:
someArray = new Array(); // an empty array for(i=0; i<100; i++){ someArray[i] = new theClassName(); // in other to access the variables of the class we need to use setProperty() so that we can use the variable's value as the name setProperty(someArray[i], someProperty, 'someValue'); } my neccessity was to create a class that has the properties of the movieclip class + my own. This doesn't illustrate that, but still I hope that it will be of some use to someone. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > array of classes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|