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?
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
...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
Copy link to clipboard
Copied
Thank you, it already works, but in the second frame change the instance name of the dynamic text : score by score 1