Hello there folks. As the title suggests I am migrating a my tile isometric scripts to AS3. So pretty much what the whole thing does is is you click a certain floor tile and you have object inserted there. As I am total newb with AS3 I problems were to be expected. No the problem is not the change of the z sorting model, I took care of that. The problem is something much more “serious”. In the AS2 version I had a great number of library symbols, with linkage identifiers which were stored in an array. Then on the press of a tile I attached a symbol of my liking, (selected prior to the tile click). Something remotely similar to the following;
var objects:Array = ["Box1","Box2","Box3"];
//........................
var selected:Number=2;
//.......................
content_mc.attachMovie(objects[selected],"someName",content.getNextHighestDepth());
Ok, thats an oversimplified version of it but hope you get the idea. Now in AS3 the library symbols are classes by themselves. Therefore I have to use the following syntax:
var someName:Box1 = new Box1();
So I have pretty much no idea how can I achieve what I want. Only thing which comes to mind is create array of (few hundred :stare:) simple functions, and use the appropriate one.
var funcs:Array=new Array();
funcs[0]=function () {
var box1:Box1=new Box1();
return (box1);
};
funcs[1]=function () {
[LEFT]var box2:Box2=new Box2();
[/LEFT]
return (box2);
};
//.....................
var selected:Number=2;
//.....................
funcs[selected]();
Any better ideas?
Thank you