[Beye] Onclick method linked to game.js

Game development with Board Game Arena Studio
Post Reply
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

[Beye] Onclick method linked to game.js

Post 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?
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

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

Post by sourisdudesert »

Hello Rudolf,

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

Cheers,
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

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

Post by Rudolf »

I know with dojo.connect... but it is possible to make a direct link???
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

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

Post by sourisdudesert »

Hello Rudolf,

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

Cheers,
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

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

Post 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.
Post Reply

Return to “Developers”