Livecode上的图像幻灯片放映

时间:2014-11-07 03:12:54

标签: livecode

我为幻灯片放映创建了2张图片,但我遇到了问题。我的问题是当第一张图像淡入第二张图像时。堆栈冻结。当图像淡入完成时,堆栈恢复正常。

代码。

command aniFadehide curF
    Switch noFa
      case 1
         lock screen for visual effect in rect (the rect of img 1 of grp curF)
         show img 2 of grp curF
         hide img 1 of grp curF
         unlock screen with visual effect dissolve very fast
         add 1 to noFa
         break
      case 2
         lock screen for visual effect in rect (the rect of img 1 of grp curF)
         show img 1 of grp curF 
         hide img 2 of grp curF 
         unlock screen with visual effect dissolve very fast
         put 1 to noFa
         break
   end Switch
   send "aniFadehide curF" to me in 3 secs 
end aniFadehide

1 个答案:

答案 0 :(得分:0)

在使用视觉效果之前,我做了一些事情。首先,我总是通过获得QTVersion来加载QT。这可能不再适用于LiveCode 7,除非您将dontUseQT设置为false。

其次,我执行一个看不见的视觉效果,以确保我有"冻结"在我真正需要视觉效果之前,在我身后。 E.g。

on openStack
  lock screen for visual effect
  // nothing here, but you can but something if you want
  unlock screen with visual effect dissolve very fast
  pass openStack
end openStack

此处理程序执行视觉效果,但由于您没有使用其他卡并且不显示或隐藏控件,因此使用只是认为他/她等待软件启动。

接下来,您的脚本似乎有一点错误,因为put 1 to noFa应为put 1 into noFa

您的全局或局部变量可能也存在问题。所以,我制作了一个工作脚本并将其发布在这里。该脚本将在一个按钮中运行。

global noFa

local lCounter


on mouseUp
     put the pendingMessages into myMsgs
     filter myMsgs with "*aniFadehide*"
     repeat for each line myLine in myMsgs
          cancel item 1 of myLine
     end repeat
     put 1 into noFa
     put 0 into Counter
     aniFadehide 1
end mouseUp

command aniFadehide curF
     add 1 to lCounter
     Switch noFa
          case 1
               lock screen for visual effect in rect (the rect of img 1 of grp curF)
               show img 2 of grp curF
               hide img 1 of grp curF
               unlock screen with visual effect dissolve very fast
               add 1 to noFa
               break
          case 2
               lock screen for visual effect in rect (the rect of img 1 of grp curF)
               show img 1 of grp curF 
               hide img 2 of grp curF 
               unlock screen with visual effect dissolve very fast
               put 1 into noFa
               break
     end Switch
     if lCounter < 10 then
          send "aniFadehide curF" to me in 3 secs 
     end if
end aniFadehide