Revision: 50169
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 13, 2011 08:21 by ryanstewart
Initial Code
<?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="FacebookAuthView"
backgroundAlpha="0" actionBarVisible="false"
viewActivate="view1_viewActivateHandler(event)"
removing="view1_removingHandler(event)"
creationComplete="view1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import com.facebook.graph.FacebookMobile;
import mx.events.FlexEvent;
import spark.events.ViewNavigatorEvent;
import vo.Profile;
private var thisProfile:Object;
private var facebookWebView:StageWebView;
override public function set data(value:Object):void
{
thisProfile = value as Profile;
}
override public function createReturnObject():Object
{
return thisProfile;
}
protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
{
facebookWebView = new StageWebView();
facebookWebView.viewPort = new Rectangle(0,0,stage.width,stage.height);
var permissions:Array = ["publish_stream"];
FacebookMobile.login(onLogin,this.stage,permissions,facebookWebView);
}
private function onLogin(success:Object,fail:Object):void
{
thisProfile.facebookConnected = true;
// navigator.popView();
}
protected function view1_removingHandler(event:ViewNavigatorEvent):void
{
facebookWebView.dispose();
}
protected function view1_creationCompleteHandler(event:FlexEvent):void
{
FacebookMobile.init("your dev key here",onLogin);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:View>
Initial URL
Initial Description
Using the Facebook AS3 library to authenticate in a Flex Mobile View
Initial Title
Facebook Auth View
Initial Tags
Initial Language
ActionScript 3