我有图像文件.gif。我的图像有5帧,我想循环1到3.第4帧和第5帧我点击时会播放。我可以这样做吗?
答案 0 :(得分:1)
这是一个有两种模式的简短示例;
所有代码都来自卡片脚本..
local sFrameStartA, sFrameEndA, sMode, sFrame
on openCard
-- tuen off automatic animation - we will set the frames manually
set the repeatCount of image "MyImage" to 0
-- mode 1 (normal) frames 1 - 3
put 1 into sFrameStartA[1]
put 3 into sFrameEndA[1]
-- mode 2 (frame 4 - 5) after click
put 4 into sFrameStartA[2]
put 5 into sFrameEndA[2]
put 0 into sFrame
put 1 into sMode
-- start animation
send "animate" to me in 0 millisecs
end openCard
on animate
-- animate : next frame
add 1 to sFrame
-- check the frame number is valid - if not, reset to the start frame
if sFrame < sFrameStartA[sMode] or sFrame > sFrameEndA[sMode] then
put sFrameStartA[sMode] into sFrame
end if
-- update the image's frame
set the currentFrame of image "MyImage" to sFrame
send "animate" to me in 500 millisecs
end animate
on mouseUp
-- clicking the image will switch to mode 2 - frames 4-5
if the short name of the target = "MyImage" then
put 2 into sMode
end if
end mouseUp