In a class I am trying to have a function create new properties that have variable, number-indexed, names.
Let’s say my object is called ‘Book’. And so I want to run a for-loop to assign to it a series of new properties along with a value for each, e.g.
book.chapter1 = “the beginning”
book.chapter2 = “the next day”
book.chapter3 = “the middle”
book.chapter4 = …etc.
I used–naively–the set function in the loop to give the properties variable names evaluated from expressions, and that doesn’t work–i guess it works only for variables and not properties.
Also had problems using trace. How do I trace the value of each property within the loop? Using trace(eval(“book.chapter”+i)) won’t work…
Here is the code i have if u need to see it:
dynamic[<<guess this is not nec.??] class Multi_array extends Object[<<nec.??] {
private var mybook:Object;
private var temp:String;
public function set_me_up() {