상세 컨텐츠

본문 제목

Adobe AIR 액션스크립트 as3 윈도우창 위로 올리기 front 관련

ADOBE/ ActionScript

by AlrepondTech 2016. 7. 4. 14:15

본문

반응형

 

 

 

 

 

=================================

=================================

=================================

 

 

 

 

 

출처: http://stackoverflow.com/questions/21331537/adobe-air-bring-to-front

 

 

I have an adobe AIR app. When I send some data with a local connection from a web page, I want the app in front of the browser and all the other windows.

I tried with both activate() and orderToFront() but I have no results.

The only script working is:

window.alwaysInFront=true;

window.alwaysInFront=false;

But this doesn't give the focus to the app. So when I click the button on the browser, I have the app on the top, but if I click on the browser the app stays on top until I click on it (giving it the focus) and than I click on the browser window again. It works fine If I click on the browser top bar. I think that activate() would solve the problem giving the focus to the app, but doesn't work.

Here it is the code (I worked with the native window to resize, minimize and maximize the window too). The function I call from local connection is "primopiano"

import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.display.MovieClip;  import flash.display.NativeWindow;  var window = stage.nativeWindow;  function trascina (event:MouseEvent) {     window.startMove(); } ...  function primoPiano (event) {     trace("porto in primo piano...");     //window.activate(); // doesn't work     //window.orderToFront(); // doesn't work      window.alwaysInFront=true;     window.alwaysInFront=false; }

Did I forgot to import something or do I have to define a different window to do this?

Thanks! Nadia

----------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Have a look at the Documentation and API Reference

AIR provides several methods for directly changing the display order of windows. You can move a window to the front of the display order or to the back; you can move a window above another window or behind it. At the same time, the user can reorder windows by activating them.

You can keep a window in front of other windows by setting its alwaysInFront property to true. If more than one window has this setting, then the display order of these windows is sorted among each other, but they are always sorted above windows which have alwaysInFront set to false. Windows in the top-most group are also displayed above windows in other applications, even when the AIR application is not active. Because this behavior can be disruptive to a user, setting alwaysInFront totrue should only be done when necessary and appropriate. Examples of justified uses include:

  • Temporary pop-up windows for controls such as tool tips, pop-up lists, custom menus, or combo boxes. Because these windows should close when they lose focus, the annoyance of blocking a user from viewing another window can be avoided.
  • Extremely urgent error messages and alerts. When an irrevocable change may occur if the user does not respond in a timely manner, it may be justified to push an alert window to the forefront. However, most errors and alerts can be handled in the normal window display order.
  • Short-lived toast-style windows.

Note: AIR does not enforce proper use of the alwaysInFront property. However, if your application disrupts a user’s workflow, it is likely to be consigned to that same user’s trash can.

I have tried:

window.alwaysInFront = true; window.alwaysInFront = false; window.activate();

You could also try with a reference to a display object on the window stage:

displayObject.stage.nativeWindow.alwaysInFront=true;  //(where displayObject is your instance name)

And works fine. I'm using Adobe AIR 4

----------------------------------------------------------------------------------------------------------------------------------------
Thanks, but I already tried it, and seems that window.activate(); has no results, it has no focus. – Nadia Jan 24 '14 at 14:07
    
Hey @Nadia, I just edited my answer with another example, hope will help you – gabriel Jan 24 '14 at 14:22
    
alwaysinFront works fine for me too, it brings the window on the fornt, but doeasn't give the focus on it. That's why I try with activate(); and doesn't work. Tried your displayObject.stage.nativeWindow.activate() and nothing changes... AIR 2 (to compile, the player is 4.0.0.139) – Nadia Jan 24 '14 at 16:44 

 

 

=================================

=================================

=================================

 

 

 

 

반응형


관련글 더보기

댓글 영역