Skip to main content
January 20, 2014
Question

Displaying integers

  • January 20, 2014
  • 2 replies
  • 294 views

I am new to flash and I have a question that's kinda newbie..

I have a variable integer called "score" I want to display it in another scene. Let's say I type var score:int = 0 and I pick up 5 coins (every coin up the value of score by 1) so my score is 5. Then i progress to the next scene and i want to display the value of score. How do I do that?

This topic has been closed for replies.

2 replies

Participating Frequently
January 20, 2014

steps:

1. Create a text box type, dynamic text.

2. An instance name for the box, eg "displayResult".

3. Copy and paste this text box where you want the result to appear.

4. In actionscript code vc presents the results as follows:

var total: int = 15;

displayResult.text = String (total);

Ned Murphy
Legend
January 20, 2014

I recommend avoiding the use of scenes and just develop along the one timeline either by using different sections of it for the different scenes you want or different movieclips that you control the visibility of.  Then as long as you have the layer where you declared the score extended the length of the timeline you can assign/read its value any time.