Results 1 to 2 of 2
  1. adma84's Avatar
    285 Posts
    Global Posts
    323 Global Posts
    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

    this.controller.listen(document, 'orientationchange', this.handleOrientation.bindAsEventListener(this));
    THen I drop into a bit of code that does something like:

    MainAssistant.prototype.handleOrientation = function(event){
   "<===========Entered handleOrientation")
        if (event.position == 4 || event.position == 5) {
            this.controller.stopListening(document, "orientationchange", this.handleOrientation.bindAsEventListener(this))
                'name': 'car-summary'
            }, this.fillUpSummary, this.mileageTrack.reverse());
        }"<===========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!
    My Programs: TipIt(TipCalc), FillUps
  2. mosdl's Avatar
    781 Posts
    Global Posts
    787 Global Posts
    The reason this isn't working is because you are not referencing the same event listener.

    What you need to do is this:

    this.hoHandle = his.handleOrientation.bindAsEventListener(this);
    this.controller.listen(document, 'orientationchange', this.hoHandle);
    and then:

     this.controller.stopListening(document, "orientationchange", this.hoHandle)
    Apps: MyQ for Netflix (Phone/TouchPad), Giantbomb (Phone), Excavate (Reddit/Digg clients for TouchPad)

Posting Permissions