I have a DisplayObject.startDrag() method in a MouseEvent.MOUSE_DOWN listener that works on android, mac and html5 but crashes on neko.
Here’s the error:
openfl test neko
Invalid call
Called from Game.hx line 59
Called from openfl/_v2/events/EventDispatcher.hx line 98
Called from a C function
Called from openfl/_v2/display/DisplayObject.hx line 244
Called from openfl/_v2/display/Stage.hx line 912
Called from openfl/_v2/display/Stage.hx line 387
Is the target object typed as a DisplayObject or Sprite, or is it Dynamic, somehow? Neko explodes at times when it does not know the actual type of the target object, even though you are referencing a valid property or method
var character : Sprite;
public function startDragCharacter( e : MouseEvent )
{
character = e.target;
character.startDrag();
stage.addEventListener( MouseEvent.MOUSE_UP , stopDragCharacter );
}
whereas previously it was more like:
public function startDragCharacter( e : MouseEvent )
{
e.target.startDrag(); // doesn't work on neko due to the function call on a Dynamic object.
stage.addEventListener( MouseEvent.MOUSE_UP , stopDragCharacter );
}
A Dynamic is a dynamic object that can have 0 or more methods and 0 or more properties assigned to it at runtime.
I’m guessing that the neko runtime has its own dynamic object (or just uses a map instead) and it doesn’t support methods (or certain types of methods). Am I close?
Yeah, I think Neko VM has a lookup table for shared methods and properties, and unless it knows the type at runtime it fails to look it up. Something like that