Results 1 to 12 of 12
  1.    #1  
    Alright, well I have one scene "FirstScene" and then another scene "SecondScene". Right now I have "FirstScene" using
    Code:
    Mojo.Controller.stageController.pushScene("session", data);
    Which works fine, the "SecondScene" is pushed with the correct argument. Then when the user swipes back on the gesture area I have it disconnect from the server and then
    Code:
    Mojo.Controller.stageController.popScene();
    so it goes back to "FirstScene"... That also works fine, the only problem now is that when I press my button to launch "SecondScene" again, the forward and back gestures aren't triggered anymore... Other events work fine though.
  2. manderton's Avatar
    Posts
    2 Posts
    Global Posts
    5 Global Posts
    #2  
    so you have a listener on the swipe back gesture that disconnects some server connection before going back? why put that in a listener? couldn't you just put that code in deactivate or cleanup and let the back gesture just do it's own thing?
  3.    #3  
    Er... No, I'm not using a listener for the back and forward gestures, it automatically triggers "Scene.prototype.handleCommand". The problem is it won't trigger handleCommand if I load the "SecondScene" again... Everything works perfectly the first time, but not after.
  4. #4  
    Kinda hard to tell what's going on from your description. Are you using a custom .handleCommand() ? And are you running any listen/stopListen commands of your own?
    danNielson.com - Slalom - twitter - facebook
    A posted thanks dies with the thread. Clicking the button lasts until the admins get bored with this site and throw it in the recycling bin.
  5. #5  
    Quote Originally Posted by clacombe View Post
    Er... No, I'm not using a listener for the back and forward gestures, it automatically triggers "Scene.prototype.handleCommand". The problem is it won't trigger handleCommand if I load the "SecondScene" again... Everything works perfectly the first time, but not after.
    You should put your disconnect code in the cleanup() function, which is automatically called when a back swipe is called.

    Unless it takes more than a couple seconds for the disconnect, in which case it will forcibly leave the scene.

    If you post some of your code, we can help you. If need be, you can PM me the code and I can help privately so you don't have your code publicly available.
    Arthur Thornton

    Former webOS DevRel Engineer at Palm, HP, and LG
    Former webOS app developer (built Voice Memos, Sparrow, and several homebrew apps and patches)
    Former blogger for webOS Nation and webOS Roundup
  6.    #6  
    Ok let me clarify. From my understanding the Mojo.Event.back and Mojo.Event.forward events automatically trigger the .handleCommand() function. So I wouldn't need to have a custom listener for them. Everything works fine the first time that "Session" scene is pushed but any time after that, Mojo.Event.back and Mojo.Event.forward won't trigger the handleCommand() function automatically like it does the first time. If you still need me to explain this more just let me know.
  7. #7  
    Ok, first, code from your setup, activate, deactivate, and cleanup methods as well as any relevant code from your stage assistant would help us to isolate the problem. Second, are you trying to forward swipe back to your 'Session' scene after you've swiped back? If so, you DO need to define a custom .handleCommand() that either hides the scene instead of popping it or redefines the forward gesture to push the Session scene again. Interestingly enough, there doesn't seen to be a built in method for doing the first, though it should be as simple as finding the div containing the stage and doing a .hide() on it.
    danNielson.com - Slalom - twitter - facebook
    A posted thanks dies with the thread. Clicking the button lasts until the admins get bored with this site and throw it in the recycling bin.
  8.    #8  
    Ok so you're saying that I need to have a custom listener event for the forward gesture, right? If so, then what do I have it listen to?
    Code:
    Mojo.Event.listen(WhatToListen?..., Mojo.Event.forward, this.forwardGesture.bind(this));
  9. #9  
    Quote Originally Posted by clacombe View Post
    Ok so you're saying that I need to have a custom listener event for the forward gesture, right? If so, then what do I have it listen to?
    Code:
    Mojo.Event.listen(WhatToListen?..., Mojo.Event.forward, this.forwardGesture.bind(this));
    You don't need a listener. All you have to do is add this code to your scene assistant:

    Code:
        YourAssistant.prototype.handleCommand = function(event) {
            
            if (event.type == Mojo.Event.forward) {
                   // Add your code here
            }
            
        },
    Of course if you already have a handleCommand routine in your scene assistant, you would just add the Mojo.Event.forward block into the existing routine.
    Quick Post: The quick way to post messages and photos to Twitter & Facebook (video link)
    Music Player (Remix): The next generation music listening experience on webOS (video link)
    GeoStrings: Set location-based reminders and never forget another task (video link)

    Twitter: @Hedami
  10.    #10  
    Right, that's what I have right now and it works fine the first time the "Session" scene is pushed but any time the "Session" scene is pushed after the first time, it won't trigger the handleCommand function...
  11. #11  
    Quote Originally Posted by clacombe View Post
    Right, that's what I have right now and it works fine the first time the "Session" scene is pushed but any time the "Session" scene is pushed after the first time, it won't trigger the handleCommand function...
    Have you placed a log statement at the beginning of the handleCommand routine to verify it's not getting in the routine? Perhaps an exception is occurring either in this routine or before it gets to this routine.
    Quick Post: The quick way to post messages and photos to Twitter & Facebook (video link)
    Music Player (Remix): The next generation music listening experience on webOS (video link)
    GeoStrings: Set location-based reminders and never forget another task (video link)

    Twitter: @Hedami
  12.    #12  
    Wow, my bad, lol. Ok I fixed it, I just wasn't resetting a variable back to false once the scene was closed. Thanks for your help

Posting Permissions