The value of the label component does not show
Hello,
I am having trouble displaying the value of my label component. There are no errors in my code, but when I test it in the movie and press a button, the text or value that I assign on my label does not seem to appear. Please let me know what I did wrong in my coding, any help is appreciated.
This is my code:
Disclaimer: This is not the whole code, it is part of it. I am just showing you the section of my code where I am having trouble with.
Problem: I have assign a value for my label, but does not appear on the test movie when a button is clicked.
Name for each label on each function: First is lbltotalScore, Second is lblLowestScore, Third is lblhighestScore.
// This is the totalScore function
// golfScore array of numbers
// returns the total value in the array
function totalScore(golfScore):Number
{
var y:Number = 0;
for (var z:int=0; z<golfScore.length; z++)
{
y += golfScore
lbltotalScore.text = "Total:" + golfScore
}
return y;
}
// This is the lowestScore function
// golfScore array of numbers
// returns the lowest value in the array
function lowestScore(golfScore):Number
{
var a:Number = golfScore[0];
for (var b:int=1; b<golfScore.length; b++)
{
if (golfScore < a)
{
a = golfScore;
lblLowestScore.text = "Lowest Score:" + golfScore;
}
}
return y;
}
// This is the highestScore function
// golfScore array of numbers
// returns the highest value in the array
function highestScore(golfScore):Number
{
var c:Number = golfScore[0];
for (var d:int=1; d<golfScore.length; d++)
{
if (golfScore
{
c = golfScore
lblhighestScore.text = "Highest Score:" + golfScore
}
}
return c;
}
