Be a Supporter!

What's the code?

  • 289 Views
  • 6 Replies
New Topic Respond to this Topic
Bumbanut
Bumbanut
  • Member since: Jul. 30, 2008
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
What's the code? 2009-07-14 10:47:22 Reply

I'm making a new game and I need the code to show the score the person who plays has. I haven't done flash in a long while, so I forgot. Please remind me. Thank you.

Jereminion
Jereminion
  • Member since: Nov. 6, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to What's the code? 2009-07-14 10:48:42 Reply

u just draw a text box, give it instance name and say textbox.text = score

WhoknowsmeaUdiO
WhoknowsmeaUdiO
  • Member since: Apr. 11, 2007
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to What's the code? 2009-07-14 10:50:12 Reply

Assuming you have a variable called score, put this code in the same spot as where you declare that variable:

_root.sct.text = score;

Then make a dynamic text box somewhere on the frame and give it the instance name of

sct

In case you haven't noticed yet, this isn't my main anymore. PM me here.

BBS Signature
Bumbanut
Bumbanut
  • Member since: Jul. 30, 2008
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to What's the code? 2009-07-14 11:01:49 Reply

Ok, how about to add a score when you release a button?

WhoknowsmeaUdiO
WhoknowsmeaUdiO
  • Member since: Apr. 11, 2007
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to What's the code? 2009-07-14 11:29:54 Reply

on(release){
score ++;
};

At least try to learn ActionScript before asking.


In case you haven't noticed yet, this isn't my main anymore. PM me here.

BBS Signature
MrNine
MrNine
  • Member since: Jul. 4, 2007
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to What's the code? 2009-07-14 13:10:46 Reply

At 7/14/09 11:01 AM, Bumbanut wrote: Ok, how about to add a score when you release a button?

well it really depends on how much score you want to add so

on(press){ OR on (release) { - depends on what you want
score += (whatever score you want to add, if it's just one then put ++);
}

blah569
blah569
  • Member since: Jan. 18, 2005
  • Offline.
Forum Stats
Member
Level 25
Programmer
Response to What's the code? 2009-07-14 14:52:14 Reply

As stated above, this would work using AS2:

On the timeline:

var score:Number = 0;

On your button:

on (release)
{
     _root.score++;
}

Also, by the way, there isn't "the code" to do something, there are several different methods to accomplish tasks.


BBS Signature