按下 facebook 按钮后,用户登录,然后该 web 视图立即转到 facebook 移动站点。我需要的是让那个 webview 消失,这样我就可以继续与我的应用程序交互,而不是 facebook 移动网站。
如果我不清楚,我很抱歉,现在是凌晨 5 点,我在这里有点疯狂,哈哈。看看代码...
<?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"
backgroundColor="#2F28C1" title="Setup"
creationComplete="application1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import com.facebook.graph.FacebookMobile;
import mx.events.FlexEvent;
import views.setup_first.facebook;
import views.setup_first.flickr;
import views.setup_first.google;
import views.setup_first.tumblr;
import views.setup_first.twitter;
public var permissions:Array = ["user_birthday", "read_stream", "publish_stream"];
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
FacebookMobile.init("262320357178421", loginHandler);
}
protected function loginHandler(success:Object,fail:Object):void
{
}
protected function login():void
{
var facebookWebView:StageWebView = new StageWebView();
facebookWebView.viewPort = new Rectangle (0,0, stage.width, stage.height);
FacebookMobile.login(loginHandler, this.stage, permissions, facebookWebView);
trace("I'm logged in!");
}
protected function logout():void
{
FacebookMobile.logout(onLogout, "https://m.facebook.com/dialog/permissions.request?app_id=262320357178421&display=touch&next=http%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html&type=user_agent&perms=publish_stream&fbconnect=1");
}
protected function onLogout(result:Object):void
{
trace("Perfect Log Out!")
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:navigationContent/>
<s:Button left="62" top="86" click="navigator.pushView(views.setup_first.google)"
icon="@Embed('../Setup/Setup_0002_Layer-5.png')"/>
<s:Button right="64" top="86" click="login()" icon="@Embed('../Setup/Setup_0001_Layer-6.png')"/>
<s:Button click="navigator.pushView(views.setup_first.tumblr)" horizontalCenter="-4"
icon="@Embed('../Setup/Setup_0000_Layer-7.png')" verticalCenter="-14"/>
<s:Button left="62" bottom="117" click="navigator.pushView(views.setup_first.flickr)"
icon="@Embed('../Setup/Setup_0004_Setup.png')"/>
<s:Button right="63" bottom="117" click="navigator.pushView(views.setup_first.twitter)"
icon="@Embed('../Setup/Setup_0005_Layer-1.png')"/>
<s:Button right="54" bottom="10" label="Skip" click="navigator.pushView(thirdPage)"/>
<s:Button id="logOut" x="323" y="210" height="28" label="LogOut" fontSize="15"
click="logout()"/>