我正在制作一个 Adobe Air 应用程序。当我在 flash 中运行我的应用程序时,我的 StageWebView 对象位于 x0, y0 我想要的位置。在 Flash 中编译时,StageWebview 内容占用 320 像素 x 50 像素。闪光阶段为 480x800。
当我在移动设备上编译和运行我的应用程序时,即使 Air 原生尺寸和手机分辨率为 480x800,StageWebview 也会被拉伸并泄漏到屏幕右侧。StageWebView 内容还可以使用滚动条来查看所有内容。
如何让我的设备版本显示为我的 Flash 预览版本?
闪码
imports
import flash.events.Event;
import flash.events.LocationChangeEvent;
import flash.geom.Rectangle;
import flash.media.StageWebView;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.events.TouchEvent;
// setup variables
var _stageWebView:StageWebView;
var myAdvertURL:String = "website link here";
//
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT
function createAd():void {
// check that _stageWebView doersn't exist
if (! _stageWebView) {
_stageWebView = new StageWebView () ;
// set the size of the html 'window'
_stageWebView.viewPort = new Rectangle(0,0,320,50);
// add a listener for when the content of the StageWebView changes
_stageWebView.addEventListener(LocationChangeEvent.LOCATION_CHANGING,onLocationChange);
// start loading the URL;
_stageWebView.loadURL(myAdvertURL);
}
// show the ad by setting it's stage property;
_stageWebView.stage = stage;
}
function onLocationChange(event:LocationChangeEvent):void {
// check that it's not our ad URL loading
if (_stageWebView.location != myAdvertURL) {
// stop the content from loading within StageWebView
event.preventDefault();
// Launch a normal browser window with the captured URL;
navigateToURL( new URLRequest( event.location ) );
}
}
createAd();
HTML
<!DOCTYPE html>
<html>
<head>
<link href="layout-style-admob.css" rel="stylesheet" type="text/css" >
<title>Admob</title>
</head>
<body>
<script async src="xxxxxxx.js"></script>
<!-- mobiletestad2 -->
<ins class="adsbygoogle"
style="display:inline-block;width:320px;height:50px"
data-ad-client="xxxxxxxxxxx"
data-ad-slot="xxxxxxxxx"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
CSS
html,body {
}
body {
min-width:320px;
max-width:320px;
width:320px;
min-height:50px;
max-height:50px;
height:50px;
margin:0px;
}
任何帮助将不胜感激。