我是这个社区的新人,我正在学习,我知道我会问新手问题,但请赐教!在我的标签视图应用程序(它是一个IOS应用程序)我有一个标签,我想在应用程序中加载一个网页,我按下了一个按钮“刷新”,当它按下它弹出一个新的视图,我想加载一个网页链接(HTTPS)!我看了一些教程,但我不能让它工作,这是用刷新按钮查看的代码 `
<fx:Script>
<![CDATA[
protected function butRefresh_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<s:Button id="butRefresh" width="153" height="96" label="Refresh"
click="navigator.pushView(cursHtml)" enabled="true" horizontalCenter="0"
verticalCenter="9"/>
` 这是页面加载'
的视图<?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" title="cursHtml">
<fx:Script>
<![CDATA[
import spark.events.ViewNavigatorEvent;
protected function cursHtml_viewActivateHandler(event:ViewNavigatorEvent):void
{
navigateToURL(new URLRequest("https://www.alphabank.ro/ro/rate/rate_si_dobanzi.php"));
// StageWebView.loadString(data.description);
}
/* StageWebView = new StageWebView();
//StageWebView.view = new Rectangle(dragBar.x, dragBar.y+20, 800, 600);
// StageWebView = stage;
// StageWebView."http://www.google.co.uk/"; */
/* StageWebView = stage;
StageWebView.stage = new Rectangle(20, 100, 450, 450);
StageWebView("https://www.alphabank.ro/ro/rate/rate_si_dobanzi.php"); */
]]>
</fx:Script>
</s:View>
'我评论了我做的最后一次尝试!以及我已经删除的其他人
答案 0 :(得分:0)
你用代码做了一些奇怪的事情:
var 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" title="cursHtml">
<fx:Script>
<![CDATA[
import spark.events.ViewNavigatorEvent;
protected function cursHtml_viewActivateHandler(event:ViewNavigatorEvent):void
{
stageWebView.loadURL(data.description);
//assuming that data.description stores URL
}
private var stageWebView:StageWebView;
//stuff below this line needs to be in a method body, also I see the viewport rectangle call is missing a close paren, adding it now
stageWebView = new StageWebView();
stageWebView.stage = this.stage;
stageWebView.viewPort = new Rectangle(dragBar.x, dragBar.y+20, 800, 6)
]]>
</fx:Script>
</s:View>