触摸在Livecode中透明的背景图像

时间:2014-07-12 08:18:39

标签: livecode

我有一张图片,我的图片是透明的。我已将以下代码添加到我的图片中:

on mouseUp
  --do something()
end mouseUp

当我触摸透明区域上的图像时,我的脚本无法正常工作。现在,我使用按钮而不是图像,但按钮无法旋转。我想用一张图片。我怎么能这样做?

3 个答案:

答案 0 :(得分:2)

一种可能的解决方案:您可以在图像后面添加一个控件(如图像,图形,按钮等),并将它的blendLevel设置为100.这将使其不可见,但仍会响应鼠标/触摸事件。然后,您可以使用隐藏对象来接收触摸。

答案 1 :(得分:2)

另一种解决方案可能是从图像中删除mouseUp处理程序并将其放入卡片脚本中;

-- Card Script: on mouseUp if the clickLoc is within the rect of img "XYZ" then doSomething end mouseUp

注意:如果您需要在图像中使用mouseUp来执行其他操作,那么在完成其他操作时只需传递mouseUp。 e.g;

-- Image Script: on mouseUp -- do something with the image pass mouseUp end mouseUp

答案 2 :(得分:2)

另一种选择是将图像设置为透明按钮的图标。