Page 1 of 1

[Beye] Onclick method linked to game.js

Posted: 08 April 2013, 22:14
by Rudolf
Hello Friends...

I just have a problem with my onclick method:
In TPL I put this:

Code: Select all

<div id="board"> 
	<!-- BEGIN boardblock -->
	<div id="r{ROW}{COL}" 	class="rshow stylescouts" 
				onmouseover="style.borderColor='#FFFFFF'"
				onmouseout="style.borderColor='#8B4513'" 
				onclick="RockClick({ROW},{COL})"
				style="top:{RTOP}px;left:{RLEFT}px"></div>
	<div id="p{ROW}{COL}" 	class="pshow styleplaincard"  	
				onmouseover="style.borderColor='#FFFFFF'"
				onmouseout="style.borderColor='#8B4513'" 
				onclick="PlainClick({ROW},{COL})"
				style="top:{PTOP}px;left:{PLEFT}px"></div>
	<!-- END boardblock -->	
</div>
then in game.js
I put (to check click is running):

Code: Select all

///////////////////////////////////////////////////
        //// Utility methods
        
        /*
        
            Here, you can defines some utility methods that you can use everywhere in your javascript
            script.
        
        */

	RockClick: function (ROW,COL)
	{
		this.showMessage("Click="+ROW+COL, 'error' );
		
	},
it seems the function RockClick is not found by template... Could you tell me how I can manage it?
maybe prefix RockClick with ebg or dojo?

Re: [Beye] Onclick method linked to game.js

Posted: 10 April 2013, 10:50
by sourisdudesert
Hello Rudolf,

All you need to do it is there:
http://en.doc.boardgamearena.com/Game_i ... yers_input

Cheers,

Re: [Beye] Onclick method linked to game.js

Posted: 10 April 2013, 12:23
by Rudolf
I know with dojo.connect... but it is possible to make a direct link???

Re: [Beye] Onclick method linked to game.js

Posted: 10 April 2013, 12:31
by sourisdudesert
Hello Rudolf,

No. The correct solution with Dojo is to use dojo.connect.

Cheers,

Re: [Beye] Onclick method linked to game.js

Posted: 10 April 2013, 14:48
by Rudolf
ok... strange, even I put it outside the code of dojo in beye.js (beginning or end) it's not linked...
by the way, I will use connect.
thanks.