我正在使用 HTML/JS/PHP 开发一个移动应用程序,并且我正在使用 flex StageWebView 作为应用程序主机。我将 Ajax 用于“更多帖子...”按钮,该按钮试图在不刷新页面的情况下加载更多帖子,但它在 flex StageWebView 中不起作用,并且我在页面加载完成后显示 StageWebView。
在浏览器和 Android webView 中它工作正常。有任何想法吗?
JS:
function loadFeed(start, filter) {
$('#more_messages').html('<div class="load_more"><div class="preloader-retina-large preloader-center"></div></div>');
if(filter == '') {
q = '';
} else {
q = '&filter='+filter;
}
$.ajax({
type: "POST",
url: "requests/load_feed.php",
data: "start="+start+q,
cache: false,
success: function(html) {
$('#more_messages').remove();
// Append the new comment to the div id
$('#messages').append(html);
// Reload the timeago plugin
jQuery("div.timeago").timeago();
autosize();
}
});
}
柔性:
protected function addedToStageHandler(event:Event):void
{
webView = new StageWebView();
webView.addEventListener(Event.COMPLETE,onWebViewComplete);
webView.addEventListener(ErrorEvent.ERROR,onWebViewError);
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGE,onWebViewLocationChange);
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGING,onWebViewLocationChanging);
webView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);
trace(webView.location);
webView.loadURL("URL");
}
protected function onWebViewComplete(event:Event):void
{
trace("Complete!");
webView.stage = this.stage;
}