The error is one of the output ones, which give no info on why I get the error.Code:package { import flash.display.Sprite; import flash.events.*; public class MagnetGolf extends Sprite { public var puck:Puck; public var puckVX:Number; public var puckVY:Number; public var minusCharges:Array; public function MagnetGolf() { puck = new Puck(); addChild(puck); puck.x = 20; puck.y = 240; puckVX = 1; puckVY = 0; plusCharges = new Array(); for (var i:int = 0; i < 5; ++i) { var c:MinusCharge = new MinusCharge(); addChild(c); c.x = Math.random() * 550; c.y = Math.random() * 400; minusCharges.push(c); } addEventListener(Event.ENTER_FRAME, update, false, 0, true); } function update(e:*=null):void { puck.x += puckVX; puck.y += puckVY; } } }
Something that might help: If I take away the line minusCharges.push(c); it doesn't give me that error. So I assume c doesn't exist yet?? But i added it a couple of lines up with addChild! Help please!TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MagnetGolf()




Reply With Quote
