如何使用代码而不是检查器工具更改实时代码中按钮的图标?

How do I change the icon of a button in livecode, using code and not the inspector tool?

我想让按钮在特定事件发生时改变外观。我认为代码看起来像这样:

on mouseUp
   set the icon of this button to the id 1044
end mouseUp

按钮的图标是它的正常外观,在检查器中,当您将某个图像的 ID 放入图标中时 space 图像将呈现具有该图标的任何外观。什么代码可以让我这样做

set the icon of button "abc" to 1044

set the icon of button "abc" to the id of image "source image"

在这两种情况下,您都将按钮的图标 属性 设置为图像对象的 ID。

您也可以根据需要的图片名称来设置图标。假设您有一个名为 "foo" 的按钮和一个名为 "bar":

的图像
set the icon of button "foo" to "bar"