Skip to main content
izyanrazl
Participant
May 19, 2017
Answered

score and lives -games actionscript 3.0

  • May 19, 2017
  • 3 replies
  • 2549 views

hi, anyone can help me..

how to increase score if correct answer and minus score if wrong answer with coding action script 3.0

[Moved from the Lounge (which is where you can "connect with your peers" from across all of Adobe's products for conversations that don't directly relate to help and support) to a product-specific support forum - moderator]

This topic has been closed for replies.
Correct answer Nick Gioia

Try this tutorial. Flash Score Counter Tutorial - YouTube

3 replies

izyanrazl
izyanrazlAuthor
Participant
May 20, 2017

Hi, PLEASE HELP ME.....

do you think my coding is OK?

this score cannot function on another timeline *label*...

var total:int = 0;

myScore.text = total.toString();

blink_btn.addEventListener(MouseEvent.CLICK,fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void

{

  total = total + 1;

  myScore.text = total.toString();

}

ignore_btn.addEventListener(MouseEvent.CLICK,fl_MouseClickHandler_2);

function fl_MouseClickHandler_2(event:MouseEvent):void

{

  total = total - 1;

  myScore.text = total.toString();

}

kglad
Community Expert
Community Expert
May 19, 2017

use a variable to track the score, a variable for the amount to adjust the score for a correct answer and a third variable for the amount to adjust the score for an incorrect answer.  eg,

var score:int = 0;

var correctInc:int = 10;

var incorrectInc:int = -5;

you can then use something like:

function scoreF(b:Boolean):void{

if(b){

score+=correctInc;

} else {

score+=incorrectInc;

}

Nick GioiaCommunity ExpertCorrect answer
Community Expert
May 19, 2017
izyanrazl
izyanrazlAuthor
Participant
May 20, 2017

thank you a lot, its very helpful..

I have another question..

i make 1 simple games and i want to know how can i continue the score to another "label timeline"?