actionscript-3flashapache-flexairstagewebview

Adobe Air stagewebview not using useNative browser


Hi I am creating a desktop flex application with a stagewebview that will not use the native browser instead of the old webkit. The documentation says to specify useNative as true in the first parameter like below. Anyone have an idea?

I am building on windows with Air 17 and Flash Builder. The user agent is always:

Mozilla/5.0 (Windows; U; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) AdobeAIR/17.0

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       applicationComplete="stageTest(event)" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[

            import flash.geom.Rectangle;
            import flash.media.StageWebView;

            private var webView:StageWebView;

            public function stageTest(e:*) {

                webView = new StageWebView(true);

                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;

                webView.stage = this.stage;
                webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight );
                webView.loadURL( "http://whatsmyuseragent.com/" );

            }

        ]]>
    </fx:Script>

</s:WindowedApplication>

Solution

  • From an Adobe forum post

    The documentation says AIR 2.5+, because StageWebView, and thefore the constructor, was added in AIR 2.5, but useNative was added in AIR 3.9 I think

    If you specify swf-version 19 or higher, you'll see the native browser being used.

    n.b. the forum post mentions swf-version 22, but testing shows that version 18 vs. 19 is when this behavior changes.