Commas for numbers in script.
Hello!
So I am building a program in flash that will run a jeopardy scoreboard just like the C# file at this website (Jeopardy! | Coding4Fun Articles | Channel 9) as it is cheaper for me to build it in flash than to pay $80+ for a Phidget. Everything has been going fine. However, I can't get the string to add commas for the life of me! I've tried the NumberFormatter class, but nothing happens. I tried to import it but it doesn't work nor do I get code building hints. I would say my knowledge of AS3 is ahead of a N00B, but not yet intermediate. I'm doing this purely for a hobby.
This code is below. I am working on the first player and the $200:button, so everything here is in relation to the first player's score and the +/- $200 functions:
var firstPlayerScore:int;
firstPlayerScore = 0
var questionValue:Number = 0;
p1Score.text = "$"+String(firstPlayerScore);
p1200btn.addEventListener(MouseEvent.CLICK, firstNumber);
p1addbtn.addEventListener(MouseEvent.CLICK, addP1);
p1minusbtn.addEventListener(MouseEvent.CLICK, dropP1);
function firstNumber(Event:MouseEvent):void {
questionValue = 200
}
function addP1(Event:MouseEvent):void {
firstPlayerScore = firstPlayerScore + questionValue;
p1Score.text = "$"+String(firstPlayerScore);
questionValue = 0
}
function dropP1(Event:MouseEvent):void {
firstPlayerScore = firstPlayerScore - questionValue;
p1Score.text = "$"+String(firstPlayerScore);
questionValue = 0
}
//End code
Any help would be greatly appreciated. Thanks!
