Results 1 to 7 of 7
  1.    #1  
    Scene Pushing: I can push my initial scene, I've even pushed a second scene from the application menu. What I seem to be having an issue with is pushing a scene from another scene.

    Scenerio: I have my initial scene called "main", and on the HTML page, I have a button which when pressed, should push another scened called "newentry." Thus far, all attempts have failed.

    In my main-scene.html, I have:

    Code:
    <button id="new" class='palm-button'>New Entry</button>
    <div id="c"></div>
    In my main-assistant.jsjsjs $I$ $have$:

    Code:
    MainAssistant.prototype.setup = function() {
    	
    // Listen for button tap to create NEWENTRY
    	Mojo.Event.listen($('new'), Mojo.Event.tap, this.pushNewEntry.bind(this));
    }
    
    MainAssistant.prototype.pushNewEntry = function(event){
    this.controller.pushScene("newentry");
    }
    I thought, apparently erroneously, that the same code used to push the main scene that I use in the stage-assistant.jsjsjs $could$ $be$ $used$ $in$ $main$-$assistant$.$js$ $to$ $push$ $my$ $scene$ $called$ &$quot$;$newentry$.&$quot$; $Again$, $not$ $so$.

    In order to test whether my coding of the button and basic button handling procedure was correct, I modified my main-assistant.jsjsjs $to$:

    Code:
    MainAssistant.prototype.setup = function() {
    
    // Listen for button tap to create NEWENTRY
    	Mojo.Event.listen($('new'), Mojo.Event.tap, this.pushNewEntry.bind(this));
    }
    
    MainAssistant.prototype.pushNewEntry = function(event){
    document.getElementById('c').innerHTML = "Hello World";
    //this.controller.pushScene("newentry");
    }
    When I run it like that, it prints the Hello World message in the appropriate div, which tells me that my basic structure for acknowledging and responding to the button press works - and that it definitely is my syntax for pushing the other scene that is the problem.

    Can anyone shed some light on this for me?
  2. cooltpmd's Avatar
    Posts
    75 Posts
    Global Posts
    77 Global Posts
    #2  
    You need to call your stage assistant to do the push. I write a stageAssistant function that basically says (.pushScene("thedesiredScene") and pass it the name of the scene from wherever you are.

    Hope this is clear.
  3.    #3  
    I had thought that, but what I tried didn't work.

    So if I put this in my stage-assistant.jsjsjs:

    Code:
    StageAssistant.prototype.pushNewEntry = function(event){
    this.controller.pushScene("newentry");
    }
    What is the syntax to call it from my initial scene, because what I tried before didn't work.
  4. #4  
    Mojo.Controller.getAppController().getStageController('stage').pushScene('newscene');
  5. cooltpmd's Avatar
    Posts
    75 Posts
    Global Posts
    77 Global Posts
    #5  
    Respond to your event:

    MainAssistant.prototype.pushNewEntry = function(event){

    this.controller.stageController.pushScene("mynextScene");

    }
  6.    #6  
    Thanks cooltpmd, that did the trick.
  7. saiks's Avatar
    Posts
    92 Posts
    Global Posts
    106 Global Posts
    #7  
    Hi all,

    How can i push a new scene from lets say "login" to "list". When i first launch the app, "login'" is push with StateAssistant under set up yo "login". While in login, under mybutton function i want to push scene to list. Anyh help is greatly appreciated.

Posting Permissions