我带着一个三角形,我正试着旋转它。图像旋转正常,我没有任何问题。但我有一个问题,只有当我点击我可以旋转的实际点时,三角形才会获得焦点。但这并没有发生。我附上了一张解释这个问题的图片。我在swf运行时没有遇到任何问题。但在DHTML运行时,我遇到了这个问题。这与我使用的图像有什么关系吗?
我使用的是Openlaszlo5.0,在windows firefox16.0中测试,三角形的测试图像是PNG。

发布于 2012-11-30 02:18:28
根据您的描述,我假设您使用的是一个在单击时具有内置bringToFront()调用的类,例如basewindow。有了这样的类,您可以覆盖bringToFront()方法,并检查鼠标是否在您希望响应的区域内,然后决定是否调用super.bringToFront()。为简单起见,我的示例只是检查点击是否在正方形的右半部分,但您可以在应用程序中插入公式以确定它是否在三角形的点内:
<canvas width="1000" height="584" debug="true">
<basewindow id="v1" width="100" height="100" x="25" y="25" bgcolor="0xff0000" clickable="true">
<method name="bringToFront">
<![CDATA[
var x = this.getMouse('x');
var y = this.getMouse('x');
Debug.debug('x='+x);
Debug.debug('y='+y);
// Ensure mouse is within right half:
if (x>(this.width)/2)
super.bringToFront();
]]>
</method>
</basewindow>
<basewindow id="v" width="100" height="100" x="50" y="50" bgcolor="0xcccccc" clickable="true">
<method name="bringToFront">
<![CDATA[
var x = this.getMouse('x');
var y = this.getMouse('x');
Debug.debug('x='+x);
Debug.debug('y='+y);
// Ensure mouse is within right half:
if (x>(this.width)/2)
super.bringToFront();
]]>
</method>
</basewindow>
</canvas>我在OL 4.9.0 SWF10中测试了它,它工作正常。
https://stackoverflow.com/questions/13624182
复制相似问题