Created
June 13, 2011 01:36
-
-
Save ejhayes/1022204 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" | |
width="600" | |
height="300" | |
creationComplete="initApp()"> | |
<s:states> | |
<s:State name="loggedout"/> | |
<s:State name="loggedin"/> | |
</s:states> | |
<fx:Script> | |
<![CDATA[ | |
import com.facebook.graph.Facebook; | |
protected function initApp():void | |
{ | |
Facebook.init("225736574120291",loginHandler); | |
} | |
protected function loginHandler(success:Object,fail:Object):void | |
{ | |
if(success){ | |
currentState="loggedin"; | |
Facebook.api("/me",getMeHandler); | |
usrImg.source = Facebook.getImageUrl(success.uid,"square"); | |
Facebook.api("/me/statuses",getStatusHandler); | |
} | |
} | |
protected function getMeHandler(result:Object,fail:Object):void | |
{ | |
nameLbl.text=result.name; | |
} | |
protected function postHandler(result:Object,fail:Object):void | |
{ | |
} | |
protected function getStatusHandler(result:Object, fail:Object):void | |
{ | |
statusLbl.text=result[0].message; | |
} | |
protected function login():void | |
{ | |
Facebook.login(loginHandler,{perms:"read_stream,publish_stream,user_birthday"}); | |
} | |
protected function logout():void | |
{ | |
Facebook.logout(logoutHandler); | |
currentState="loggedout"; | |
} | |
protected function logoutHandler(response:Object):void | |
{ | |
} | |
]]> | |
</fx:Script> | |
<fx:Declarations> | |
<!-- Place non-visual elements (e.g., services, value objects) here --> | |
</fx:Declarations> | |
<s:Button includeIn="loggedout" right="10" top="10" label="Login" click="login()" | |
skinClass="skins.FBLoginSkin"/> | |
<s:Button includeIn="loggedin" right="10" top="10" label="Logout" click="logout()" | |
skinClass="skins.FBLogoutButtonSkin"/> | |
<s:Label includeIn="loggedin" x="64" y="19" text="User:"/> | |
<s:Label id="nameLbl" includeIn="loggedin" x="105" y="19" text="Label"/> | |
<s:Label includeIn="loggedin" x="64" y="35" text="Status:"/> | |
<s:Label id="statusLbl" includeIn="loggedin" x="105" y="35" text="Label"/> | |
<s:Image id="usrImg" includeIn="loggedin" x="10" y="10"/> | |
</s:Application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | |
<head> | |
<title></title> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> | |
<script type="text/javascript"> | |
var flashvars = {}; | |
var params = {}; | |
params.allowscriptaccess = "sameDomain"; | |
var attributes = {}; | |
attributes.id = "FlashDiv"; | |
attributes.name = "FlashDiv"; | |
swfobject.embedSWF("FacebookDemo.swf", "FlashDiv", "550", "400", "10.0.0", "expressInstall.swf", flashvars, params, attributes); | |
</script> | |
</head> | |
<body> | |
<!-- this line is really necessary --><div id="fb-root"></div> | |
<div id="FlashDiv"> | |
<h1>You need at least Flash Player 10.0 to view this page.</h1> | |
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment