Why do I get "undefined is not a function. The problem occurs when I want to create the Player variable in the main function. Everything worked before I used the onload function and the init WebGL and function main, didn't exist. Their content was just written in a script in the html file. So there is no problem with the creation of the new Player in the external file. Somehow the function just does not exist.
Here is a part of my html file
<head>
<script src="player.js" type="text/javascript"> </script>
<script src="main.js" type="text/javascript"></script>
</head>
<body onload="initWebGL()">
<canvas id="canvas" width="800" height="600"> </canvas>
</body>
my main.js
function initWebGL() {
//......
main();
}
function main() {
// Player
var Player = new Player();
//.....
undefined is not a functionis from? (which line?)