haxe - HaxeFlixel. Access violation reading location 0x00000008 -


i have sprite can drag around on screen. want able drag sprite area (box). stands can drop sprite box, when drag directly inn, the program crashes.

*im developing in flashdevelop windows gave me av option debug in vs.

i debugged in vs , got error:

unhandled exception @ 0x00accee9 in proj.exe: 0xc0000005: access violation reading location 0x00000008. 

relevant code:

class drag extends flxgroup {  var mousejoint:distancejoint;  public inline function registerphyssprite(spr:flxnapesprite) {     mouseeventmanager.add(spr, createmousejoint);  }  function createmousejoint(spr:flxsprite) {      var body:body = cast(spr, flxnapesprite).body;      mousejoint = new distancejoint(flxnapestate.space.world, body, new vec2(flxg.mouse.x, flxg.mouse.y),                             body.worldpointtolocal(new vec2(flxg.mouse.x, flxg.mouse.y)), 0, 0);      mousejoint.space = flxnapestate.space; }   override public function update():void {     super.update();      if (mousejoint != null)     {         mousejoint.anchor1 = new vec2(flxg.mouse.x, flxg.mouse.y);          if (flxg.mouse.justreleased)         {             mousejoint.space = null;         }     }   }  }  class playstate extends flxnapestate {     override public function create()     {     super.create();     bgcolor = flxcolor.black;     napedebugenabled = true;      var light = new light(10, 10);     var box = new box(100, 100);     var drag:drag;      createwalls(1, 1, 1024, 768, 10, new material(1, 1, 2, 1, 0.001));      add(light);     add(box);      drag = new drag();     add(drag);                                                              drag.registerphyssprite(light);      light.body.velocity.y = 200;      flxnapestate.space.listeners.add(new interactionlistener(         cbevent.begin,          interactiontype.collision,          light.cb_type,         box.cb_type,         collidelightbox));     }      function collidelightbox(callback:interactioncallback)     {         var light:light = cast callback.int1.castbody.userdata.sprite;         light.kill();     } }  class light extends flxnapesprite {     public static var cb_type(default, null) = new cbtype();      public function new(x:float, y:float)     {         super(x, y);         makegraphic(10, 10, flxcolor.transparent);         var radius = 5;         drawcircle(5, 5, radius, flxcolor.white);         createcircularbody(radius);         body.cbtypes.add(cb_type);          body.userdata.sprite = this;     } }  class box extends flxnapesprite {     public static var cb_type(default, null) = new cbtype();      public function new(x:float, y:float)     {         super(x, y);         makegraphic(100, 50, flxcolor.green);         createrectangularbody(width, height);         body.cbtypes.add(cb_type);         body.type = bodytype.static;     } } 

if you're possibly accessing null pointer, consider answer given in question: why haxe try-catch block still crashing, when using release mode c++ target

that way can turn on null pointer checks in hxcpp can better debug information.

also, if you're trying debug hxcpp directly in flashdevelop (step-through , that), feature isn't released yet, spoke team , they're working on it.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -