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

how to pass variable value betewen timeline animate html5??

New Here ,
Oct 25, 2020 Oct 25, 2020

Copy link to clipboard

Copied

HI. NEED YOUR HELP.

 

THE MOST SIMPLE, I HAVE A BUTTON TO JUMP TO THE NEXT FRAME (NEXT) AND I HAVE A DYNAMIC TEXT (SCORE).

 

THE CODE IN THE FIRST FRAME "index label" IS THIS

 

this.stop();
var _this = this;

this.next.on('click', function(){
	_this.gotoAndStop('pag1');
});

//I generated the variable "count" to later add

var count = 1;
this.score.text = count;

 

IN THE SECOND FRAME "pag1 label" I HAVE ONLY THIS

 

this.stop();

this.score.text = count;

I JUST WANT IT TO WORK AT CLIP LEVEL, AND ALREADY TRY USING THIS

 

 

this.count = 1;

 

BUT IT DOESN'T WORK, MAYBE IT'S BECAUSE I DO NOT KNOW WHERE TO PUT IT EXACTLY

 

WHAT SHOULD I PUT IN FRAME 1 SO THAT FRAME 2 STILL HAVE THE SAME VALUE?

Views

358

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

correct answers 1 Correct answer

Community Expert , Oct 26, 2020 Oct 26, 2020

Hi.

 

Firstly make the count variable a property of the main timeline by using the this keyword. Like this:

this.stop();
var _this = this;

this.next.on('click', function(){
	_this.gotoAndStop('pag1');
});

this.count = 1;
this.score.text = this.count;

 

Then, if you want to access the count property in another frame of the main timeline, you can do this:

this.stop();
this.score.text = this.count;

 

But, if you want to access the count property from within a Movie Clip or somewhere else, use the

...

Votes

Translate

Translate
Community Expert ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

Hi.

 

Firstly make the count variable a property of the main timeline by using the this keyword. Like this:

this.stop();
var _this = this;

this.next.on('click', function(){
	_this.gotoAndStop('pag1');
});

this.count = 1;
this.score.text = this.count;

 

Then, if you want to access the count property in another frame of the main timeline, you can do this:

this.stop();
this.score.text = this.count;

 

But, if you want to access the count property from within a Movie Clip or somewhere else, use the automatically generated global variable exportRoot.

this.stop();
this.score.text = exportRoot.count;

 

Please let us know if you still have any questions.

 

Regards,

JC

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
New Here ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

LATEST

Thank you, it already works, but in the second frame change the instance name of the dynamic text : score by score 1

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