Here we go again. I am trying to populate an array of objects and assign it to a data slot in application.onAppStart. This is my code: //----- CLASS DECLARATION Team = function(teamNumber, teamName) { // Instance properties this.teamNumber = teamNumber; // Team number this.teamName = teamName; // Team name } Team.prototype.setTeamName = function() { this.teamName = 'Blammo'; } // ---- INSTANTIATION this.teams = new Array(); for (var n = 0; n <6; n++) { MyTeam = new Team (n, 'team' + n); var myTeam.setTeamName(); // WORKS FINE WITHOUT THIS this.teams.push (MyTeam); } This doesn't work. But amazingly, if I leave out the method call line, it works. I am totally exasperated with FlashCom. As a .Net programmer, I am astounded that Macromedia persist in trying to persuade the world that it is possible to write good-quality, server-class apps with a scrip language, virtually non-existent server debugging facilities and endless silent fails. I really, really want my organisation to use this product to replace an in-house .Net app that we have, which is currently running thousands of users per month, but it really is going nowhere.
Sorry - the instantiation bit should read: this.teams = new Array(); for (var n = 0; n <6; n++) { var MyTeam = new Team (n, 'team' + n); myTeam.setTeamName(); this.teams.push (MyTeam); } But it still doesn't work. 2.5 hours tonight so far.
Don't see what you're looking for? Try a search.
|