【问题标题】:Adobe Director - Lingo QuizAdobe Director - Lingo 测验
【发布时间】:2013-03-08 02:25:28
【问题描述】:

所以我正在使用 Adob​​e Director 进行测验,但我在整体环境中遇到了困难。

我将以下 Lingo 脚本添加到每个按钮,并提供正确答案:

  on mouseDown
    global gscore
    set gscore = gscore + 1

在最后阶段,我使用以下 Lingo 脚本来检查获得的点,并为结果显示适当的精灵。

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 的值显示某个自定义精灵。

【问题讨论】:

    标签: lingo adobe-director


    【解决方案1】:

    很高兴您找到了解决方案。另一种方法是根本不使用 if 语句。您的 enterframe 脚本可能是这样的:

    在输入框上 sprite(3).memberNum = 154+gscore 结束

    【讨论】:

      【解决方案2】:

      想通了,抱歉。

      我删除了所有结尾的 if 以使其成为完整的 if 语句。在第一个使用的脚本上设置全局变量,将值声明为 0。然后在递增时将其添加到先前定义的同名全局变量。

      我相信我的问题在于全局变量实例的默认值是 void。

      【讨论】:

        【解决方案3】:
        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
        
        end
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-12-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多