Highlighted

Why cods 'total' does not work when I press the button 'home_but4'??

Explorer ,
Mar 24, 2019

Copy link to clipboard

Copied

Why cods 'total' does not work when I press the button 'home_but4'??

this.stop();

this.total = 0;

this.B2.addEventListener("click", a1App22.bind(this));

function a1App22() {

this.beed.play();

this.beed.visible = true;

this.goood.visible = false;

this.B2.mouseEnabled = false;

this.B3.visible = false;

this.end.visible = true;

this.total--;

this.selection();

}

//////////////////////////

this.B3.addEventListener("click", a1App33.bind(this));

function a1App33() {

this.beed.play();

this.end.visible = true;

this.beed.visible = true;

this.goood.visible = false;

this.B2.visible = false;

this.B3.mouseEnabled = false;

this.total++;

this.selection();

}

this.selection = function () {
if (this.total == 1) {
  this.front1.snow1.visible = true;
  this.front1.snow2.visible = false;
  this.front1.snow3.visible = false;
 
} else {

  if (this.total == 2) {
   this.front1.snow1.visible = true;
   this.front1.snow2.visible = true;
   this.front1.snow3.visible = false;

  } else {

   if (this.total == 3) {
    this.front1.snow1.visible = true;
    this.front1.snow2.visible = true;
    this.front1.snow3.visible = true;

   }

}

this.home_but4.addEventListener("click", home10.bind(this));

function home10() {

this.gotoAndStop(35);

this.total = 0;

}

***The  problem 'total' retains its value and is NOT equal to zero ---'this.total = 0;'?

Message was edited by: تقنية المعلومات

Hi

if I see this right, then alert("total") gives you only the string "total", not its value.

try console.log(this.total);

Klaus

TOPICS
Discussions

Views

371

Likes

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

Why cods 'total' does not work when I press the button 'home_but4'??

Explorer ,
Mar 24, 2019

Copy link to clipboard

Copied

Why cods 'total' does not work when I press the button 'home_but4'??

this.stop();

this.total = 0;

this.B2.addEventListener("click", a1App22.bind(this));

function a1App22() {

this.beed.play();

this.beed.visible = true;

this.goood.visible = false;

this.B2.mouseEnabled = false;

this.B3.visible = false;

this.end.visible = true;

this.total--;

this.selection();

}

//////////////////////////

this.B3.addEventListener("click", a1App33.bind(this));

function a1App33() {

this.beed.play();

this.end.visible = true;

this.beed.visible = true;

this.goood.visible = false;

this.B2.visible = false;

this.B3.mouseEnabled = false;

this.total++;

this.selection();

}

this.selection = function () {
if (this.total == 1) {
  this.front1.snow1.visible = true;
  this.front1.snow2.visible = false;
  this.front1.snow3.visible = false;
 
} else {

  if (this.total == 2) {
   this.front1.snow1.visible = true;
   this.front1.snow2.visible = true;
   this.front1.snow3.visible = false;

  } else {

   if (this.total == 3) {
    this.front1.snow1.visible = true;
    this.front1.snow2.visible = true;
    this.front1.snow3.visible = true;

   }

}

this.home_but4.addEventListener("click", home10.bind(this));

function home10() {

this.gotoAndStop(35);

this.total = 0;

}

***The  problem 'total' retains its value and is NOT equal to zero ---'this.total = 0;'?

Message was edited by: تقنية المعلومات

Hi

if I see this right, then alert("total") gives you only the string "total", not its value.

try console.log(this.total);

Klaus

TOPICS
Discussions

Views

372

Likes

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
Mar 24, 2019 0
Adobe Community Professional ,
Mar 24, 2019

Copy link to clipboard

Copied

how are you testing to determine whether this.total=0 or not?

Likes

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
Reply
Loading...
Mar 24, 2019 0
Explorer ,
Mar 24, 2019

Copy link to clipboard

Copied

Because when the buttons 'B2 AND .B3' are pressed, the order is executed >>>

this.total--;

this.total++;

Likes

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
Reply
Loading...
Mar 24, 2019 0
Adobe Community Professional ,
Mar 26, 2019

Copy link to clipboard

Copied

again, how are you testing to determine whether this.total=0 or not?

Likes

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
Reply
Loading...
Mar 26, 2019 0
Explorer ,
Mar 27, 2019

Copy link to clipboard

Copied

alert('total');

But no value appears "total" ?

Likes

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
Reply
Loading...
Mar 27, 2019 0
Adobe Community Professional ,
Mar 27, 2019

Copy link to clipboard

Copied

there are two errors in alert('total').  there should be no quotes and it should be this.total (and this needs to be the same reference where this.total=0 is located and where alert(this.total) is located.

Likes

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
Reply
Loading...
Mar 27, 2019 2
Advocate ,
Mar 27, 2019

Copy link to clipboard

Copied

Hi

if I see this right, then alert("total") gives you only the string "total", not its value.

try console.log(this.total);

Klaus

Likes

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
Reply
Loading...
Mar 27, 2019 2
Explorer ,
Apr 08, 2019

Copy link to clipboard

Copied

Likes

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
Reply
Loading...
Apr 08, 2019 0
Explorer ,
Apr 09, 2019

Copy link to clipboard

Copied

why ??

Likes

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
Reply
Loading...
Apr 09, 2019 0