[SOLVED] Why "addList()" not working second time in begin() or added() function?


(Bora Kasap) #1

I have this code in my level1world, but “addList(GLOBALS.leftuilist)” only works one time even i use it in added() or begin() or constructor. It is not working when i quit level and load level again. Do you have any idea?

override public function begin():void
		{
			addList(GLOBALS.leftuilist);
		}

And this is the code of creating “leftuilist” array and works only one time, inside a static class,(GLOBALS)

leftuilist.length = 0;
			leftuilist.push(Typing(FP.world.create(Typing, false)).init(0 + xoff, FP.height - 20 + yoff, "AMMO:", 0xFFFFFF, -1, 0, 1, false, true));
			ammotext = DynamicTyping(FP.world.create(DynamicTyping, false)).init(58 + xoff, FP.height - 20 + yoff, ammo.toString(), 0x00FF00, 1, true);
			leftuilist.push(ammotext);
			leftuilist.push(Typing(FP.world.create(Typing, false)).init(0 + xoff, FP.height - 6 + yoff, "ARMOR:", 0xFFFFFF, -1, 0, 1, false, true));
			armortext = DynamicTyping(FP.world.create(DynamicTyping, false)).init(58 + xoff, FP.height - 6 + yoff, armor.toString(), 0xFFFF00, 1, true);
			leftuilist.push(armortext);

(Bora Kasap) #2

Oh, the problem solved now. But i wasn’t expected something like that.

when i add this function in the same world, the problem solved:

override public function end():void
{
removeList(GLOBALS.leftuilist);
}