Monday, March 28, 2011

How to open real popup window in Flex

I need to open popup window in my flex / air application that will be displayed like normal application window. All I could manage is to open a window which is displayed inside my main flex window.

Is it something like that possible, and is there some workarounds if not?

From stackoverflow
  • You'll have to use a NativeWindow for that. More info the API docs: http://livedocs.adobe.com/flex/3/langref/flash/display/NativeWindow.html

    import flash.display.NativeWindowInitOptions;
    import flash.display.NativeWindowSystemChrome;
    import flash.display.NativeWindowType;
    import flash.display.NativeWindow;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.geom.Rectangle;
    
    var windowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
    windowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
    windowOptions.type = NativeWindowType.NORMAL;
    
    var newWindow:NativeWindow = new NativeWindow(windowOptions);
    newWindow.stage.scaleMode = StageScaleMode.NO_SCALE;
    newWindow.stage.align = StageAlign.TOP_LEFT;
    newWindow.bounds = new Rectangle(100, 100, 800, 800);
    
    newWindow.activate();
    
  • For a Flex application, you'll want to use mx.core.Window. For a non-Flex ActionScript application, you should use flash.display.NativeWindow.

    Dev er dev : Thanks, mx.core.Window did the trick.
  • There is a good example here for flex 3.

0 comments:

Post a Comment