Wednesday 18 May 2011

Flash scoring system

I opened flash file which I created while following motion tween demo. The goal of this demo is to create scoring system so that  score would go up by 1 every time you click on shape.
First I created another layer for actions. Gave instance name to shape and created Classic Dynamic text box in the same layer as where all the actions going to be and gave it instance name. Then entered this code to actions layer:
var score:Number =0

score+=1
scoreText.text="SCORE "+String(score)
trace("SCORE " +score)

aaa.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void
{
score+=1
scoreText.text="SCORE "+String(score)
trace("SCORE " +score)

}

And now every time you press on square shape score goes up by 1.


No comments:

Post a Comment