Home | Stories | Reviews | Treo™ Store | Accessories | Software | Discussion | Mobile | About | Search

 
 
H17 Bluetooth Headset Motorola H17 Bluetooth Headset
Just $89.95
Cradle w/ Spare Battery Slot Mobi Products Cradle w/ Spare Battery Slot for Treo Pro
Just $24.95
Slip Case Palm Slip Case for Pixi
Just $27.95
Micro-USB Travel Charger SPE Micro-USB Travel Charger for Palm Pixi / Treo Pro, Treo 800w
Just $9.95
 
Old 11/07/2009, 09:38 PM   #1 (permalink)
Member
 
Join Date: Dec 2007
Posts: 261
Thanks: 24
Thanked 18 Times in 11 Posts
Default How do I stop Listening to Orientation Events?

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!
__________________
My Programs: TipIt(TipCalc), FillUps
adma84 is offline   Reply With Quote
Old 11/07/2009, 09:56 PM   #2 (permalink)
Member
 
Join Date: Jun 2009
Location: Silicon Valley
Posts: 338
Thanks: 3
Thanked 43 Times in 24 Posts
Default

The reason this isn't working is because you are not referencing the same event listener.

What you need to do is this:

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

Code:
 this.controller.stopListening(document, "orientationchange", this.hoHandle)
__________________
Manage your Netflix Queue with
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
on your Pre!
mosdl is offline   Reply With Quote
Reply


Thread Tools
Display Modes

~


All times are GMT -4. The time now is 08:34 AM.

Creating smartphone communities
Android Central - Android reviews, news and forums Crackberry - Blackberry news, reviews and community TiPb - iPhone news, accessory reviews & forums
Pre Central - Palm Pre Review, News and Community Treo Central - Treo & Centro News and Forums WMExperts - Windows Mobile Reviews & News

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
 
 

Copyright ©1999- TreoCentral. All rights reserved : Terms of Use : Privacy Policy

TREO and TreoCentral are trademarks or registered trademarks of palm, Inc. in the United States and other countries;
the TreoCentral mark and domain name are used under license from palm, Inc.
The views expressed on this website are solely those of the proprietor, or
contributors to the site, and do not necessarily reflect the views of palm, Inc.

Explore More: Crackberry | WMExperts | the iPhone Blog | Android Central | Smartphone Experts Combined Forums