我需要帮助让我的Livecode程序完成我需要的操作。

时间:2016-07-19 02:51:41

标签: livecode

我在一个子包上创建了一些按钮和一些图形以供参考。我需要能够单击按钮将其中一个图形的实例调用到主堆栈上。然后我希望能够将该图形拖到我的其他按钮上,并将其替换为不同的图形。我很乐意为编码提供任何帮助,或者提供关于如何做类似事情的教程的链接。例如,我的基本按钮是杯子按钮。单击它时,我希望它创建一个“EmptyCup”图形的实例。但是,如果我将EmptyCup图形拖到CoffeeMachine按钮,我想用CupOCoffee替换EmptyCup,等等。

1 个答案:

答案 0 :(得分:0)

要将图形的副本放在另一个堆栈中,请使用copy命令,如下所示:

copy graphic "EmptyCup" of stack "Resources" to stack "Main Screen"

拖动时有多种方法可以更改图形,但最简单的方法是设置要更改的属性:

on mouseEnter -- goes in the "CoffeeMachine" button script
  set the style of graphic "EmptyCup" to \
     the style of graphic "CupOCoffee" of stack "Resources"
  -- you can set other properties as well, such as the backColor, etc.
end mouseEnter

如果您使用的是图片而不是图片,请改为设置imageData属性(确保图片的大小与您要使用的imageData相同):

set the width of image "EmptyCup" to ]
   the width of image "CupOCoffee" of stack "Resources"
set the height of image "EmptyCup" to ]
   the height of image "CupOCoffee" of stack "Resources"
set the imageData of image "EmptyCup" to ]
   the imageData of image "CupOCoffee" of stack "Resources"
相关问题