Hi
I have problems understanding what javascript is doing.
I have this code:
<font face="Courier New, Courier, mono">
Acts.prototype.MakeDungeon = function (text_value, mapSizeX, mapSizeY)
{
this.testFunction(2,2); //This works
Acts.prototype.MakeCustomDungeon (text_value, mapSizeX, mapSizeY, 5, 15, 150, 50);
};
Acts.prototype.MakeCustomDungeon = function (text_value, mapSizeX, mapSizeY, roomMinSize, roomMaxSize, roomMaxArea, roomsMaxNum )
{
this.testFunction(2,2); //This DOESN?T works
};
instanceProto.testFunction = function (x,y)
{
//do stuff
}</font>
I have two Acts that can be called from the editor. One has more options than the other, so when I call <font face="Courier New, Courier, mono">MakeDungeon</font>, it itself calls <font face="Courier New, Courier, mono">MakeCustomDungeon</font> and gives default values to the missing information.
The thing is that when I call <font face="Courier New, Courier, mono">this.testFunction</font>, it works only from the <font face="Courier New, Courier, mono">MakeDungeon</font>, and not the <font face="Courier New, Courier, mono">MakeCustomDungeon</font>.
When the <font face="Courier New, Courier, mono">this.testFunction</font> is called from <font face="Courier New, Courier, mono">MakeCustomDungeon</font> (via <font face="Courier New, Courier, mono">MakeDungeon</font>), I get an error message:
<font face="Courier New, Courier, mono">Javascript error! TypeError: this.testFunction is not a function</font>
Can someone help me figure out what?s going on?