People = function(num) {
_root[“Person”+num]._x = lft_rght;
}
notice that the dot in the OOP is there after the brackets but not before.
LOL… this concept, I know, will open up a bunch of doors in your head. Go with it. You’re on the way to creating everything dynamicaly, with that trick.
not quite. As I said, the example was for stuff located on the main timeline because of the _root thingy. When ever you are using the brackets to create a dynamic name inside an OOP object call you have to start from the _root and work your way up the string. You can also use parent to go back up the string, but I wont go into that yet.
In the above case you would use
i = 1;
_root.back[“pIcon”+i]._x = 100;
notice that the dot isn’t really taken out after the “_root” but before the first bracket. The reason is not entirely clear to me. It is possible that it is part of the structure of OOP because objects within other objects are sort of properties of the parents. Property names can be accessed like arrays in a/s. Arrays use brackets to name each of their elements. Not sure if that makes any sense at all, but just keep in mind the structure of it, and you really wont need to worry too much right now as to the whys.
Creating engaging and entertaining content for designers and developers since 1998.