Getting Error #1007: Instantiation attempted on a non-constructor

Diter Rojug

New Member
I've been wracking my brains out over the past few days trying to figure this one out:I'm currently making a level based game using Flashpunk. The way I handle levels is by simply passing a OGMO editor file (it's basically just a xml file with a different extension) in arrays like so:\[code\]public static var worldOneList:Array = new Array(LEVEL_WORLD_1_1, LEVEL_WORLD_1_2,etc..);public static var worldTwoList:Array = new Array(LEVEL_WORLD_1_1, LEVEL_WORLD_1_2,etc..);public static var worldLists:Array = new Array(worldOneList,worldTwoList,etc...);\[/code\]and then calling it in the form of a class that handles map creation and level logic:\[code\] public static function toLevel(worldID:int, levelID:int):void { FP.world = new LevelBase(worldLists[worldID][levelID]); }\[/code\]I can access levels just fine through the level select screen, however upon completing a level and choosing to advance to the next one, I get thrown:\[code\]Error #1007: Instantiation attempted on a non-constructor.\[/code\]With the top of the stack pointing to (in FP):\[code\] public static function getXML(file:Class):XML { var bytes:ByteArray = new file; return XML(bytes.readUTFBytes(bytes.length)); }\[/code\]The strange thing is that the first two levels will go just fine, then upon the third and any after that, it'll throw up the error.This is the code I use to change levels:\[code\]if (GlobalVar.currentLevel[1] != GlobalVar.maxLevelsInSet){ LevelLists.toLevel(GlobalVar.currentLevel[0], GlobalVar.currentLevel[1] + 1);}\[/code\]And the code to read the ogmo files (in LevelBase.as):\[code\]public function LevelBase(levelFile:Class){ levelData = http://stackoverflow.com/questions/15597385/FP.getXML(levelFile); //Parse the .oel file and give data to levelData\[/code\]I'm guessing I'm doing something pretty simple wrong? Any help would be appreciated. Cheers :)
 
Back
Top