Results 1 to 7 of 7
  1.    #1  
    I am writing an app that uses the GPS service. There are several
    scenes in it, and more than one needs to get at the GPS data.
    My first thought was to setup my GPS class in the stage assistant,
    but I don't seem to have access to services from there. Is that true?
    My next thought was to define and instantiate the class in one
    of the scenes, and write code in other scenes to access the data.
    Is there a way to do that? How do scenes communicate?


  2. #2  
    you can have one scene pass data to another scene by just adding parameters to the push scene call.

    Mojo.Controller.stageController.pushScene("myscene", this.dataVal1, this.dataVal1, event.index);
  3. #3  
    Just to elaborate,

    I found this from the WebOS Dev forums:

    In Scene1 assistant:
    var parametrosGame = {
    word : this.word
    this.controller.stageController.pushScene("game", parametrosGame);

    In Scene2 assistant:
    function GameAssistant(params) {
    /* this is the creator function for your scene assistant object. It will be passed all the
    additional parameters (after the scene name) that were passed to pushScene. The reference
    to the scene controller (this.controller) has not be established yet, so any initialization
    that needs the scene controller should be done in the setup function below. */

    this.myvar = params.word;"Game Scene...", this.myvar);
  4.    #4  
    [QUOTE=SirataXero;1792482]Just to elaborate,

    I need asynchronous ongoing communication between scenes.
  5. #5  
    hum, did i hear someone say global variable? i have no idea how to implement scenes feeding each other data in real time. globals might be the closest thing you got.
  6. #6  
    Do you want communications between STAGES? Because only one scene is active at a given time in a given stage.
  7. #7  
    Passing parameters between scenes is a kludgy way to handle it.

    Just create a class to manage the GPS functions and data separate from any particular scene. You can instantiate it globally or in your stage manager then access it from any scene.

Posting Permissions