Some problem with id attribution using addActionButton

Game development with Board Game Arena Studio
Post Reply
User avatar
mr_kywar
Posts: 4
Joined: 19 June 2017, 13:43

Some problem with id attribution using addActionButton

Post by mr_kywar »

Hi,

I dont understand why but on my actual project when i used addActionButton

Code: Select all

onUpdateActionButtons: function (stateName, args)
                {
                    console.log('onUpdateActionButtons: ' + stateName);

                    if (this.isCurrentPlayerActive())
                    {
                        switch (stateName)
                        {
                            case "playerTurn":

                                this.addActionButton('button_1_id', _('Play cards'), 'doDraw', null, false, 'blue');
                                this.addActionButton('button_2_id', _('Reset'), 'doDraw1', null, false, 'red');

                            break;
                            
                        }
                    }
the generated id isn't what i expected. Id is similar to an another player Id (present on table)

Code: Select all

<div id="generalactions">
	<a href="#" class="action-button bgabutton bgabutton_blue" onclick="return false;" id="$2351196">Play cards</a>
	<a href="#" class="action-button bgabutton bgabutton_red" onclick="return false;" id="$2351196">Reset</a>
</div>
i make multiple test (and reset my JS to exclude some other interaction) whithout result. in addition When i click one button twice events is triggered

Thx !



____ EDIT
The problem is solved by reset code in .view.php

i hope it's helping
Post Reply

Return to “Developers”