Page 1 of 1

scoreCtrl during refresh

Posted: 21 November 2015, 22:23
by Rudolf
Hello,
I cannot change the value of player_score during setup in Javascript.
I need to change it after refresh
I've tried 2 ways:
* document.getElementById('player_score_'+player_id).innerHTML= - $data; does not change anything
* this.scoreCtrl[ player_id ].setValue( - $data); scoreCtrl does not exist here.
I think scoreControl is created after so I cannot change it.

Is there any solution?
thanks.

Re: scoreCtrl during refresh

Posted: 22 November 2015, 23:12
by Quinarbre
Yeah, there are a few things (logs too for instance) that you wish you could change at setup but that aren't initialized yet.
The only workaround I found was to use onEnteringState, which is normally called just after setup, but once everything else on the page is in place.
Just try to find a way (global boolean, some simple test...) to avoid doing it everytime you enter a state.