|
-
Senior Member
[AS3 question] Class from String?
ok...so I don't know if this is possible...but...
let's say I have
stringName = "bigFootball";
is it possible to some how do somehting like this :
var ball:class[stringName] = new class[stringname]
so initialise an instance of a Class from a string of the class type?
danke
Chris x
-
Senior Member
[RESOLVED]
you do ti like this:
PHP Code:
var ClassReference:Class = getDefinitionByName(gameData.level[game.level].background.backgroundLayer) as Class; var bg = new ClassReference();
-
FK founder & general loiterer
and if it was like a bitmapData you would put in the parameters eg bg = new Classreference(0,0)... or for any class that takes parameters.
This is very very handy!
You can also create classes from loaded swf files which is even cooler, and manipulate, add to the main stage etc etc. You'll need to look for applicationDOmain in the help for that though
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|