extending sprite and implementing interface results in class that does not call super constructor

Bug #1008750 reported by Paul Pepper
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
jeash
Won't Fix
Undecided
Unassigned

Bug Description

I have create a class with the following definition:

class EntityView extends Sprite, implements IPoolable
{
....
}

This work correctly when targetting cpp, and flash, but for js I get run-time errors such as:

Uncaught TypeError: Cannot read property 'length' of null NMERTS.js:983
jeash.display.DisplayObjectContainer.$extend.jeashAddToStage NMERTS.js:983
jeash.display.DisplayObjectContainer.$extend.addChild NMERTS.js:976
com.asliceofcrazypie.rts.engine.nmebaseview.EngineView.$extend.getEntityFromPool NMERTS.js:5469
com.asliceofcrazypie.rts.engine.nmebaseview.EngineView.$extend.update NMERTS.js:5362
com.asliceofcrazypie.rts.engine.controller.EngineController.update NMERTS.js:3149
com.asliceofcrazypie.rts.Main.$extend.onEnterFrame NMERTS.js:2983
js.Boot.__init.Function.$bind.f NMERTS.js:12767
jeash.events.Listener.dispatchEvent NMERTS.js:11627
jeash.events.EventDispatcher.dispatchEvent NMERTS.js:327
jeash.display.DisplayObject.$extend.jeashDispatchEvent NMERTS.js:709
jeash.display.DisplayObject.$extend.dispatchEvent NMERTS.js:712
jeash.display.DisplayObjectContainer.$extend.jeashBroadcast NMERTS.js:893
jeash.display.DisplayObjectContainer.$extend.jeashBroadcast NMERTS.js:891
jeash.display.DisplayObjectContainer.$extend.jeashBroadcast NMERTS.js:891
jeash.display.Stage.$extend.jeashStageRender NMERTS.js:11478
js.Boot.__init.Function.$bind.f NMERTS.js:12767

I have looked at the generated source code, and the constructor looks like this:

com.asliceofcrazypie.rts.engine.nmebaseview.EntityView = function() { }

When I change it to this:

com.asliceofcrazypie.rts.engine.nmebaseview.EntityView = function() { jeash.display.Sprite.call(this); }

It functioned correctly again.

I have found that no matter what I put in the constructor, whether I add arguments, put other statements, etc, I always end up with an empty constructor (as above)

Revision history for this message
Paul Pepper (pm-pepper) wrote :

HAving considered this bug somewhat, it occurs to me that this could be an issue with the haxe js target, rather than jeash itself. In which case, I apologise.

Revision history for this message
Niel Drummond (niel-drummond) wrote :

have you managed to reproduce this on the release version of haxe ?

Revision history for this message
Paul Pepper (pm-pepper) wrote :

Yes, i probably should have specified this is using the latest realease of haxe/nme, so versions are:

Haxe [2.09]
Neko [1.8.2]
NME [3.3.3]
HXCPP [2.09.3]

Revision history for this message
Niel Drummond (niel-drummond) wrote :

This kind of error happens when you use a static initializer, e.g. you instantiate a Sprite in a static variable, or if you do not call super() early enough in the constructor to an extended DisplayObjectContainer.

Changed in jeash:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.