0

Adobe Flex / Flash ビルダー StageWebView を使用して Web ページをレンダリングしようとしましたが、電話の画面の寸法に合わせて Web ページをスケーリングせず、基本的に Web ページの右側を切り取っていません。使ってみました

<meta name="viewPort" content="width=device-width; initial-scale=1.0;
            maximum-scale=1.0; user-scalable=no;" />

これはうまくいきませんでした。以下は、私が現在使用しているFlexコードです。

<?xml version="1.0" encoding="utf-8"?>

<fx:Script>
    <![CDATA[
        import flash.media.StageWebView;
        import flash.net.URLRequest;
        import spark.events.ViewNavigatorEvent;

        protected var webView:StageWebView = new StageWebView();
        protected var openBrowser:Boolean = false; 


        protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
        {
            if (StageWebView.isSupported)
            {
                currentState = "normal";
                webView.stage = stage;
                webView.viewPort = new Rectangle(0,75,stage.stageWidth,stage.stageHeight);
                webView.addEventListener(LocationChangeEvent.LOCATION_CHANGE,onURLChange);    
                webView.loadURL("http://nealdrake.com/mls.html");    
                addEventListener(ViewNavigatorEvent.REMOVING,onRemove);
            }
            else {
                currentState = "unsupported";
                lblSupport.text = "StageWebView feature not supported";
            }    
        }

        protected function onURLChange(event:LocationChangeEvent):void
        {
            trace("URL change");
            // Uncomment the following line to load in the default browser instead... 
            //navigateToURL(new URLRequest(event.location));
        }

        protected function onRemove(event:ViewNavigatorEvent):void
        {
            this.webView.dispose();
        }
    ]]>
</fx:Script>

<s:states>
    <s:State name="normal"/>
    <s:State name="unsupported"/>
</s:states>

<s:Label id="lblSupport" includeIn="unsupported" width="95%" horizontalCenter="0" verticalCenter="0"/>

どんな助けでも大歓迎です!

4

1 に答える 1

0

それが私がこれから期待することなので、下ではなく右側を切り取っていることに驚いています。

webView.viewPort = new Rectangle(0,75,stage.stageWidth,stage.stageHeight);

次のように、幅と高さの X または Y オフセットをカウントする必要があります。

webView.viewPort = new Rectangle(0,75,stage.stageWidth,stage.stageHeight - 75);

アプリのサイズが正しくなる前に、StageWebView が初期化されている可能性があります。ビューポートを再度設定するサイズ変更ハンドラーを追加してみてください (上記のコードが取得されたコンポーネントで Event.RESIZE イベントをリッスンします)。

于 2012-06-29T03:48:34.317 に答える