所以我有一个用Adobe director做的测验,但我在整个环境中挣扎着。
我将下面的Lingo脚本添加到每个按钮,并给出正确的答案:
on mouseDown
global gscore
set gscore = gscore + 1在最后阶段,我使用以下Lingo脚本检查获取的点,并为结果显示适当的sprite。
on enterFrame
if gscore = 0 then set the memberNum of sprite (3) to 154
end if
if gscore = 1 then set the memberNum of sprite (3) to 155
end if
if gscore = 2 then set the memberNum of sprite (3) to 156
end if
if gscore = 3 then set the memberNum of sprite (3) to 157
end if
if gscore = 4 then set the memberNum of sprite (3) to 158
end if
if gscore = 5 then set the memberNum of sprite (3) to 159
end if
end所以我的错误似乎是说没有声明的变量,但它是全局的,对吗?那它怎么会认不出来呢。第一个脚本附加到与正确答案对应的按钮上,每个按钮都有一个单独的脚本将其发送到下一个问题。用于显示结果的最后一个阶段应该根据gscore的值显示特定的自定义精灵。
发布于 2013-03-08 11:26:03
我想通了,道歉。
我删除了所有的end if s,使其成为一个完整的if语句。在使用的第一个脚本上设置全局变量,将值声明为0。然后,当递增时,它会添加到先前定义的同名全局变量中。
我认为我的问题在于全局变量实例的默认值是空的。
发布于 2013-03-09 22:35:29
很高兴你想出了解决方案。另一种方法是根本不使用if语句。您的enterframe脚本可能如下所示:
在enterframe sprite上(3).memberNum= 154+gscore end
发布于 2014-01-28 13:14:29
on exitframe me
global gscore。
if gscore = 0
set the memberNum of sprite (3) to 154
else if gscore = 1 then
set the memberNum of sprite (3) to 155
else if gscore = 2 then
set the memberNum of sprite (3) to 156
else if gscore = 3 then
set the memberNum of sprite (3) to 157
else if gscore = 4 then
set the memberNum of sprite (3) to 158
else if gscore = 5 then
set the memberNum of sprite (3) to 159
end if
endhttps://stackoverflow.com/questions/15285657
复制相似问题