I have an issue, where I can not stop listening to orientation events once I hit the one I care about..
So to start listening, I use
Code:
this.controller.listen(document, 'orientationchange', this.handleOrientation.bindAsEventListener(this));
THen I drop into a bit of code that does something like:
Code:
MainAssistant.prototype.handleOrientation = function(event){
Mojo.Log.info("<===========Entered handleOrientation")
if (event.position == 4 || event.position == 5) {
this.controller.stopListening(document, "orientationchange", this.handleOrientation.bindAsEventListener(this))
Mojo.Controller.stageController.swapScene({
'name': 'car-summary'
}, this.fillUpSummary, this.mileageTrack.reverse());
}
Mojo.Log.info("<===========Exited handleOrientation")
};
For some reason, it keeps swappping scenes over and over, because, Im pretty sure, that stopListening command is not working :-( any ideas? Thanks!