最新 Flash 播放器和最新浏览器中的鼠标坐标问题

发布于 2024-12-08 21:48:36 字数 1960 浏览 0 评论 0原文

<?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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久光 2024-12-15 21:48:36

您可以在 MOUSE_MOVE 上添加一个侦听器来存储最后的鼠标坐标,并在 onSelectPaste 中使用它们。

You could add a listener on MOUSE_MOVE to store the last mouse coordinates and use these in onSelectPaste.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文