我试图一次显示一张图片。我总共大约20个。我需要一个按钮,按下它时会生成一个随机图像,每次按下该按钮,它都会生成一个之前未被查看的新随机图像。
基本上我希望代码只循环遍历所有图片一次,直到所有图片都被看到。
答案 0 :(得分:0)
您没有说明如何生成图像,但假设您从现有的源图像池中进行绘制,这是一种方式。
-- ASSUME SOURCE IMAGES ARE LABELED "image1", "image2", "image3"...
local theList
on mouseUp
if theList is empty then
-- CREATE A RANDOM LIST OF NUMBERS
repeat with N = 1 to 20
put N & comma after theList
end repeat
delete last char of theList
sort items of theList by random(10000)
end if
--
-- SHOW SOURCE IMAGE IN A CONTAINER IMAGE NAMED "DISPLAY"
put item 1 of theList into N
set the text of image "display" to the text of image ("image" & N)
delete item 1 of theList
end mouseUp