简体   繁体   English

仅隐藏一个 Adob​​e AIR 窗口的光标

[英]Hide cursor for only one Adobe AIR window

I have the following code which hides the cursor for an Adobe AIR app ( JavaScript ):我有以下代码可以隐藏 Adob​​e AIR 应用程序 ( JavaScript ) 的光标:

window.runtime.flash.ui.Mouse.hide();

However I have two screens displayed when the app is run, and I only want the cursor hidden on one of the windows ... How can I do this?但是,当应用程序运行时,我显示了两个屏幕,我只想将光标隐藏在其中一个窗口上......我该怎么做? As the above code will hide it for all windows!因为上面的代码会为所有窗口隐藏它!

What I have tried (based on the code posted below by Andrey):我尝试过的(基于安德烈在下面发布的代码):

window.nativeWindow.addEventListener(air.MouseEvent.ROLL_OVER, function(){

    window.runtime.flash.ui.Mouse.hide();

});

window.nativeWindow.addEventListener(air.MouseEvent.ROLL_OUT, function(){

    window.runtime.flash.ui.Mouse.show();

});

This code lives inside the ACTUAL HTML that is loaded into the window, so it only runs on the window it exists on... but doesn't work...此代码位于加载到窗口中的 ACTUAL HTML 中,因此它仅在它所在的窗口上运行...但不起作用...

Also tried: MOUSE_OVER and MOUSE_OUT还尝试过:MOUSE_OVER 和 MOUSE_OUT

I've also tried to add the mouse hide on the actual window:我还尝试在实际窗口上添加鼠标隐藏:

var secondWindow = air.HTMLLoader.createRootWindow(false, options, false, largestScreen.bounds);

    secondWindow.window.runtime.flash.ui.Mouse.hide();

Which also doesn't work... Any ideas on how I can achieve this on just one window?这也不起作用......关于如何在一个窗口上实现这一目标的任何想法?

Hide mouse on roll over event and show on roll out:在滚动事件上隐藏鼠标并在推出时显示:

private var window:Window;

private function init():void
{
    window = new Window();
    window.addEventListener(MouseEvent.ROLL_OVER, window_onRollOver);
    window.addEventListener(MouseEvent.ROLL_OUT, window_onRollOut);
    window.open();
}

private function window_onRollOver(event:MouseEvent):void
{
    Mouse.hide();
}

private function window_onRollOut(event:MouseEvent):void
{
    Mouse.show();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM