Skip to main content
Known Participant
February 20, 2021
質問

HTML5 canvas score counter

  • February 20, 2021
  • 返信数 1.
  • 511 ビュー

Good evening again! In the current project I am working I need a simple score counter. 

I have created a simple asc3 score couter with the following code:

stop();

var total:int=0;
scoreText.text = total.toString();

 

upbutton.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void
{
total = total+1;
scoreText.text = total.toString();
}

downbutton.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);

function fl_MouseClickHandler_2(event:MouseEvent):void
{
total = total-1;
scoreText.text = total.toString();
}

And I try to remake it in html5 canvas. I did the following code:

this.stop();

var total int=0;
this.scoreText.text = total.toString();

 

/* Mouse Click Event

this.upbutton_button.addEventListener("click", fl_MouseClickHandler.bind(this));

function fl_MouseClickHandler()
{
this.total = total+1;
this.scoreText.text = total.toString();
}

this.downbutton_button.addEventListener("click", fl_MouseClickHandler_2.bind(this));

function fl_MouseClickHandler_2()
{
this.total = total-1;
this.scoreText.text = total.toString();
}

And of course it does not work! Can you please help to understand where are the mistakes? The console of chrome gives the following:

Please help if you know how to proceed.

    このトピックへの返信は締め切られました。

    返信数 1

    Peru Bob
    Community Expert
    Community Expert
    February 20, 2021

    Thios is the Using the Community forum (which is the forum for issues using the forums).
    Please tell us what Adobe application you are using so that this can be moved to the proper forum for help.

    penelope16B6作成者
    Known Participant
    February 20, 2021

    Sorry, I did not see that. The Animate CC and the HTML5 canvas