最新 Flash 播放器和最新浏览器中的鼠标坐标问题
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
private var objImageDetails:Object = new Object();
private function creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
var contextMenu:ContextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
var menuItem:ContextMenuItem = new ContextMenuItem("Paste\u00A0");
menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,onSelectPaste);
//menuItem.enabled = false;
contextMenu.customItems.push(menuItem);
this.contextMenu = contextMenu
objImageDetails.source = "assets/flower.jpeg";
}
private function onSelectPaste(event:ContextMenuEvent):void
{
var objImage:Image = new Image();
objImage.source = objImageDetails.source;
objImage.x = this.mouseX;
objImage.y = this.mouseY;
this.addElement(objImage);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:Image id="FlowerImage" source="assets/flower.jpeg" />
</s:Application>
执行应用程序后,请右键单击该应用程序并选择粘贴。继续这样做。有时你可能会面临这个问题。图像被粘贴到其他 x/y 中,而不是粘贴到 mouseX/mouseY 中。
我在使用右键单击从最新浏览器获取鼠标坐标时遇到问题。以前它可以在 Firefox 5.5 等旧版浏览器上正常工作。
mouseY 值在右键单击时向下移动一些像素,因此会影响粘贴操作 它不会粘贴在确切的位置。有时会发生这种情况。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
private var objImageDetails:Object = new Object();
private function creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
var contextMenu:ContextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
var menuItem:ContextMenuItem = new ContextMenuItem("Paste\u00A0");
menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,onSelectPaste);
//menuItem.enabled = false;
contextMenu.customItems.push(menuItem);
this.contextMenu = contextMenu
objImageDetails.source = "assets/flower.jpeg";
}
private function onSelectPaste(event:ContextMenuEvent):void
{
var objImage:Image = new Image();
objImage.source = objImageDetails.source;
objImage.x = this.mouseX;
objImage.y = this.mouseY;
this.addElement(objImage);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:Image id="FlowerImage" source="assets/flower.jpeg" />
</s:Application>
After executing the application please right click on the application and select paste. Keep on doing that. At some time u can face the issue. The image gets pasted in some other x/y rather than pasting at mouseX/mouseY.
I face problem in getting the mouse coordinates from the latest browsers using right click. Previously it was working fine with older browsers like Firefox 5.5.
the mouseY value moves some pixels down on right click so it affects the paste opration
It does not paste at exact location. It happens some times.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
MOUSE_MOVE
上添加一个侦听器来存储最后的鼠标坐标,并在onSelectPaste
中使用它们。You could add a listener on
MOUSE_MOVE
to store the last mouse coordinates and use these inonSelectPaste
.