Hey,
i wanna "parse" an custom Object ("Team") thriugh my event Listener to another view... But each time i wanna acces this variable, it's null.... Any idea?
Code:
function Team() { // System this.playerList; } module.exports = Team;My Team.js Class.
function createPlayerObjects( jsonData ) { // Create Team var PLAYER = require('xyz/model/Player'); var TEAM = require('xyz/model/Team'); var currentTeam = new TEAM(); currentTeam.playerList = []; for( var i = 0; i<jsonData.team_member.length; i++) { // p = Short Write var p = jsonData.team_member[i]; // Assign Data var _player = new PLAYER(); _player.name = p.user_benutzername // Push into PlayerList currentTeam.playerList.push(_player); } // Fire Event for the Userlist to update the list Ti.API.info( currentTeam ); Ti.App.fireEvent("app:team.refresh", {team:currentTeam} ); }The "info" before the fireEvent gives me a correct result... But if i am trying to acces my e.currentTeam in another file it is null... :( Do i have to "embed" the class in any way or something like that?
function teamRefresh(e) { tu.app.currentSelectedTeam = e.currentTeam; Ti.API.info(tu.app.currentSelectedTeam) Ti.API.info(e.currentTeam)Each time null...
Greetings, Nico
1 Answer
In your event, you are setting the variable to team not currentTeam. So in order to access the correct variable, you would need to access it via e.team not e.currentTeam
Your Answer
Think you can help? Login to answer this question!