More on this... it' s getting quite weird. I've managed to track down this a
bit further.

The classes are fine, but the error happens in two other classes, "Game" and
"Collider". I can't explain why it happens but I managed to find out the
lines of code that are causing it.

Here's how I've spotted this. I've modified EnemyTank to have a "render2()"
function. This only does the following:

function render2() {
       trace(super.render);
}

I would expect this function to output "[type Function]" to the output
panel.
On my original FLA, it ourfputs "undefined" instead. But my test harness
works fine.

Fiddling around with these two, I've managed to find the code causing the
"undefined". It's inside Collider, every time I access my Game static
singleton:

var shells:Array = Game.mainGame.shells;
var bmpWall:BitmapData = Game.mainGame.level.wallBmp;
Even something as basic as:  trace(Game.mainGame); causes the undefined.

Commenting these lines out makes the trace(super.render) work again... but I
can't see how this would break the inheritance between EnemyTank and
Sprite... the class is unrelated!

Here's how mainGame is defined. Maybe I need to make mainGame private and
use a get function?

class Game {
  static var mainGame:Game;
}


What do you think?
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to