Hey, Im having some trouble with getDefinitionByName. Basically I have a class called “tower_arrow”. I can create this tower and it works fine like this:
var pr = new tower_arrow();
However, I need a system that loads different towers based upon string input, so I tried replacing this with:
var C2:Class = getDefinitionByName( "tower_arrow" ) as Class;
var pr = new C2();
However, I get an error when running this second code:
ReferenceError: Error #1065: Variable tower_arrow is not defined.
at global/flash.utils::getDefinitionByName()
at code.world::world/newTower()
at code.world::placer/tryCreate()
at code.world::placer/go()
I can’t see why this wouldn’t work, the class works fine, I have imported it into the document I am using it in.
Thanks.