我在其中一个中创建了 3 个视图,我想显示静态 HTML 页面。我怎样才能?
问问题
1000 次
2 回答
0
这是我的应用程序使用 StageWebView 的视图:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
viewActivate="openSWV(event)"
viewDeactivate="closeSWV(event)"
title="Help">
<fx:Declarations>
<s:MultiDPIBitmapSource id="BACK"
source160dpi="@Embed('assets/icons/low-res/back.png')"
source240dpi="@Embed('assets/icons/mid-res/back.png')"
source320dpi="@Embed('assets/icons/high-res/back.png')"/>
</fx:Declarations>
<s:states>
<s:State name="portrait"/>
<s:State name="landscape"/>
</s:states>
<s:navigationContent>
<s:Button icon="{BACK}" label.landscape="Back" click="navigator.popView()"/>
</s:navigationContent>
<fx:Declarations>
<fx:String id="_help">
<![CDATA[
<html>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
</ul>
<table border=1 width=100%>
<tr bgcolor="#CCCCCC">
<th>Blah</th><th>Blah</th><th>Blah</th><th>Blah</th>
</tr>
<tr>
<th>6</th><td>2</td><td>4</td><td>2</td>
</tr>
<tr>
<th>7</th><td>4</td><td>2</td><td>1</td>
</tr>
<tr>
<th>8</th><td>6</td><td>1*</td><td>1</td>
</tr>
<tr>
<th>Blah</th><td>10</td><td>-</td><td>-</td>
</tr>
<tr>
<th>9</th><td>8</td><td>1*</td><td>1</td>
</tr>
<tr>
<th>10</th><td>10</td><td>0</td><td>0</td>
</tr>
</table>
<p><i>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</i></p>
</body>
</html>
]]>
</fx:String>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
import mx.events.FlexEvent;
import flash.media.StageWebView;
private var _swv:StageWebView;
private function openSWV(event:Event=null):void {
_swv = new StageWebView();
stage.addEventListener(Event.RESIZE, resizeSWV);
_swv.stage = stage;
resizeSWV();
_swv.loadString(_help);
}
private function closeSWV(event:Event=null):void {
stage.removeEventListener(Event.RESIZE, resizeSWV);
if (! _swv)
return;
_swv.dispose();
_swv = null;
}
private function resizeSWV(event:Event=null):void {
if (! _swv)
return;
var scale:Number = scale = runtimeDPI / applicationDPI;
// align to the right-bottom corner
_swv.viewPort = new Rectangle(stage.stageWidth - scale * width, stage.stageHeight - scale * height, scale * width, scale * height);
}
]]>
</fx:Script>
</s:View>
于 2012-10-25T07:34:02.210 回答
0
您可以使用StageWebView来执行此操作
可以在
http://soenkerohde.com/2010/11/air-mobile-stagewebview-uicomponent/找到它的实现
干杯
于 2012-10-24T08:14:48.833 回答