Results 1 to 5 of 5
  1.    #1  
    Hey guys, I'm building an app where I need to send multiple variables to a new scene. I've tried a couple of methods, but with no success (see below). I also read a forum that suggests using a class, although I don't see much documentation on the Palm site for building classes. How are you other developers handling this?

    Code:
    //from first assistant
    //variables date, check and description have already been set
    this.controller.stageController.pushScene('second',date,check,description);
    
    //from second assistant:
    function SecondAssistant(date,check,description) {
    	this.date = date;
    	this.check = check;
    	this.description = description;
    }
    //only date gets passed
    Code:
    //from first assistant:
    var args = new Array();
    args[0] = date;
    args[1] = check;
    args[2] = description;
    this.controller.stageController.pushScene('second',args);
    
    //from second assistant
    function SecondAssistant(args) {
    	this.date = args[0];
    	this.check = args[1];
    	this.description = args[2];
    }
    Third try:
    Code:
    //from first assistant:
    var params = {
    	date: date,
    	check: check,
    	description: description
    };
    this.controller.stageController.pushScene('second',params);
    
    //from second assistant:
    function SecondAssistant(params){
    	this.date = params.date;
    	this.check = params.check;
    	this.description = params.description;
    }
    Thanks for the help!

    David
  2. moserjj's Avatar
    Posts
    468 Posts
    Global Posts
    470 Global Posts
    #2  
    your third try looks close, did you try just

    Code:
    this.controller.pushScene('second',params);
  3. #3  
    It is easy as pie using cookies.
  4. #4  
    I don't know if this is the best practice but I just use the variable..

    in the secondassistant you could just use the array

    args[0].date = date
    args[0].check = check;
    args[0].description = description;

    You don't even need a array really. I would use the date, check and description variables.

    No need to pass anything as these work globally in multiple scenes.
    AmpachPre, your music your way.

  5.    #5  
    Thanks to everyone who responded at this point, this is a great community.

    I had something fouled up in another part of the code and data wasn't even in the variables, fixed that and now the data is moving along fine.

    For reference, the first and third examples I gave above worked fine.

    Thanks!

    David

Posting Permissions