Start application on a specific monitor in Adobe AIR

Asked

Viewed 277 times

2

I am developing an application in Adobe Air exe that uses 2 monitors, the application calculates how many monitors have the computer, and calculates using a Rectangle to popular the same.

Here it is all right, my question is why the mouse cursor has the decision to be the main monitor.

For example: If I open the app on the left screen, the app starts on the left screen, if I open the app on the right screen, the app opens on the right screen.

Is there any way to prevent the mouse from managing the main monitor?

  • As far as I know the cursor on the screen is part of the Desktop interface and not of the application and it is based on the mouse/mouse position by the user, if I understand you want to force the cursor repositioning, I find this a bad practice, since the cursor should be manipulated by the user. It’s just an opinion. Maybe I didn’t understand what you asked.

1 answer

1


First, you need to define which monitor the application will be launched on, after that, rescue the information from the display area of that monitor, for this, use the class Screen, utilize Screen.screens.length to rescue how many monitors the user is using:

var nMonitor:int = 0; //Número do primeiro monitor, por exemplo;
var areaVisivel:Rectangle = Screen.screens[nMonitor].visibleBounds; //Área do monitor

When starting the application, you can define in which area it will be launched:

//Deste jeito, com acesso ao stage da janela principal
stage.nativeWindow.x = areaVisivel.x + 100;
stage.nativeWindow.y = areaVisivel.y + 100;
//Ou deste jeito
NativeApplication.nativeApplication.activeWindow.x = areaVisivel.x + 100;
NativeApplication.nativeApplication.activeWindow.y = areaVisivel.y + 100;
  • I think his problem is not with the App window but with the mouse/mouse cursor.

  • @Guilhermebirth difficult to understand, I took into account the opening of the application, for example, in the taskbar, where Windows creates two taskbars on different monitors containing the same application shortcuts. When you click to open an application on monitor 1 the application opens on monitor 1, if you click to open on monitor 2, open on monitor 2, and so on.

  • @Guilhermenascimento, another reason is that he said "open application" and nothing related to "drag" or "position" the mouse/mouse in place "x".

  • Is there any way to prevent the mouse from managing the main monitor? -- Mouse in case is the Mouse or better the OS Cursor on the screen. What he wants is the cursor to appear on the monitor that is the main instance of the app.

  • Speaking just now of the question, I personally think that manipulating the mouse is a bad practice: http://answall.com/questions/80295/homeapplication-em-um-monitor-specific-no-adobe-air#comment163255_80295

  • Impossible to manipulate the mouse position with Adobe AIR. This was my other reason. But between us, we better wait some OP position. Rsrs

  • Thank you all for the reply. I ended up using the reply and solved the situation.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.