1 decade ago by Reefbarman
Hi All,
Just wondering if someone has come across a similar error to what I'm seeing! I have a game engine I have built that has its own javascript file include mechanism which involves loading a js file via a XMLHttpRequest then evaling the response (this is done to scope each file and to provide namescaping). Anyway certain files are getting ReferenceErrors that seem very strange! For example here is the error below then the code causing it!
with the error happening on the line with Color.prototype.toString for some reason the function Color is found?
Anyway any help is appreciated as I would like to avoid having to refactor things to use ejecta.include
Just wondering if someone has come across a similar error to what I'm seeing! I have a game engine I have built that has its own javascript file include mechanism which involves loading a js file via a XMLHttpRequest then evaling the response (this is done to scope each file and to provide namescaping). Anyway certain files are getting ReferenceErrors that seem very strange! For example here is the error below then the code causing it!
ReferenceError: Can't find variable: Color at line 9 in undefined
function Color(r, g, b, a) { this.r = r || 0; this.g = g || 0; this.b = b || 0; this.a = isset(a) ? a : 1; } Color.prototype.toString = function(sFormat){ sFormat = sFormat || "rgba"; var sColor = ""; switch (sFormat) { case "rgb": sColor = "rgb(" + this.r + "," + this.g + "," + this.b + ")"; break; default: sColor = "rgba(" + this.r + "," + this.g + "," + this.b + "," + this.a + ")"; break; } return sColor; };
with the error happening on the line with Color.prototype.toString for some reason the function Color is found?
Anyway any help is appreciated as I would like to avoid having to refactor things to use ejecta.include