我目前工作的一個賭場遊戲(我校),但我遇到了一個問題:獲得一個Int在另一幀的ActionScript 3.0
var a:int //this part is in frame 1
a = 10000
money.text = ""+a //this part is working
//this part is in another frame
lost_BTN.addEventListener(MouseEvent.CLICK, lost)
function lost (e:MouseEvent)
{
cash.text = ""+a -=50 //*1 (please see below)
}
*1) Scene 1, Layer 'Layer 1', Frame 6, Line 36 1050: Cannot assign to a non-reference value.
*1) Scene 1, Layer 'Layer 1', Frame 6, Line 36 1067: Implicit coercion of a value of type String to an unrelated type Number.
*1) Scene 1, Layer 'Layer 1', Frame 6, Line 36 1067: Implicit coercion of a value of type Number to an unrelated type String.
我不能似乎得到的信息在另一個框架中出現'a'。
賭場遊戲的學校?您是否必須在考試中使用太陽鏡?:) – HRgiger 2011-12-13 21:38:00
我認爲這部分是錯誤的:cash.text =「」+ a - = 50也許您想要的是:cash.text =「」+(a -50) – SERPRO 2011-12-13 21:41:32