• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

HTML5 canvas score counter

Community Beginner ,
Feb 19, 2021 Feb 19, 2021

Copy link to clipboard

Copied

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:

penelope16B6_0-1613781642449.png

Please help if you know how to proceed.

Views

366

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 19, 2021 Feb 19, 2021

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 19, 2021 Feb 19, 2021

Copy link to clipboard

Copied

LATEST

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines