我有这个 flash 程序,它应该根据你给它的评级来计算账单的小费。在我的提示百分比框中,我尝试将其连接起来以显示相应的值 + 百分比符号,但百分比符号未显示;只有价值在那里。下面是代码
import flash.events.MouseEvent;
var tipTotal:Number = 0;
var split:Number = 0;
var tipPercent:Number = 0;
var bill:Number = 0;
var eachShare: Number = 0;
oneStar.addEventListener(MouseEvent.CLICK, percentPopUp);
twoStar.addEventListener(MouseEvent.CLICK, percentPopUp);
threeStar.addEventListener(MouseEvent.CLICK, percentPopUp);
tipAmount_btn.addEventListener(MouseEvent.CLICK, calculateTip);
share_btn.addEventListener(MouseEvent.CLICK, calculateShare);
function percentPopUp(event:MouseEvent):void /*Tip percentage textbox will be filled with a percentage when a star is clicked on*/
{
tipPercent = 0;
if(event.target.name == "oneStar")
{
tipPercent = 5;
}
if (event.target.name == "twoStar")
{
tipPercent = 10;
}
if (event.target.name == "threeStar")
{
tipPercent = 20;
}
tipPercentage.text = tipPercent + "%";
}