我目前正在学习使用Flex制作Facebook应用程序: http://www.adobe.com/devnet/facebook/articles/flex_fbgraph_pt3.html
我已经完成了“将应用程序上传到您的Web服务器”部分的第6步,即通过FTP上传bin-debug文件夹中的Flex文件并运行它,但facebook应用程序只是不显示在Web服务器上我用。这是我上传文件的地方: http://cobacoba.netai.net/facebook/denishere/
我找不到问题,是因为网站主办还是什么?
答案 0 :(得分:0)
您的网络服务器或域目前似乎已被阻止或重定向到其他地方。这很可能是由您的网站托管服务商完成的。您应该与他们联系并询问您网站的任何问题。
答案 1 :(得分:0)
我确实使用相同的链接来开发ma facebook-flex界面,
我正在和你一起讨论代码,
使用至少flex3.5,如果你在flex3上工作,这将不起作用,是的,开发一个空中应用程序要容易得多,甚至不需要Web支持,但开发一个Web应用程序需要,需要一个网络服务器,你将无法检查当地机器人的Facebook应用程序,你必须将其上传到网络服务器,然后只有它将工作
我有这个代码,那是有效的,
<mx:Script> <![CDATA[ import com.Global; import com.PMSocial; import com.adobe.serialization.json.JSON; import com.facebook.graph.Facebook;
import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.controls.ToolTip; import mx.managers.ToolTipManager;
protected var topURL:String=ExternalInterface.call('top.location.toString'); [Bindable]private var facebookPhotoAlbums:ArrayCollection; [Bindable]private var facebookPhotos:ArrayCollection;
private var btn1Info:String="Click this button to log in to Facebook"; private var btn2Info:String="Logout"; private var btn3Info:String="Press this button, to get \n Album List in Drop down..";
protected function initApp():void {
Facebook.init("Your application ID",loginHandler); }
protected function loginHandler(success:Object,fail:Object):void {
if(success){
Facebook.api("/me",getMeHandler);
//userImg.source=Facebook.getImageUrl(success.uid,"small");
Facebook.api("/me/statuses",getStatusHandler);
}
else if(!success && !topURL){
ExternalInterface.call("redirect","207419415939415", "user_birthday,read_stream,publish_stream","http://apps.facebook.com/flex-connectivity/");
}
}
/* protected function loginHandler(success:Object,fail:Object):void {
if(success)
{
//currentState="loggedin";
Facebook.api("/me",getMeHandler);
//userImg.source=Facebook.getImageUrl(success.uid,"small");
Facebook.api("/me/statuses",getStatusHandler);
} } */
/* protected function loginHandler(success:Object,fail:Object):void {
if(success)
{
currentState="loggedin";
Facebook.api("/me",getMeHandler);
userImg.source=FacebookDesktop.getImageUrl(success.uid,"small");
FacebookDesktop.api("/me/statuses",getStatusHandler);
} } */
protected function login():void {
Facebook.login(loginHandler,{perms:"user_birthday,user_photos,read_stream, publish_stream"});
//Facebook.login(loginHandler,["user_birthday","read_stream","publish_stream"]); } public function logout():void {
Facebook.logout(logoutHandler);
//currentState="loggedout"; }
protected function logoutHandler(response:Object):void {
}
protected function getMeHandler(result:Object,fail:Object):void {
nameLbl.text = result.name;
//birthdayLbl.text=result.birthday;
getPhotoAlbums(); }
protected function getStatusHandler(result:Object, fail:Object):void {
//trace(result[0].message);
//statusLbl.text = result[0].message; } protected function submitPost():void {
//Facebook.api("/me/feed",submitPostHandler,{message:statusInput.text}, "POST"); }
protected function submitPostHandler(result:Object,fail:Object):void {
//statusInput.text="";
//Facebook.api("/me/statuses",getStatusHandler); }
private function getPhotoAlbums():void {
var fql:String = "select name, aid from album where owner = me()";
Facebook.fqlQuery(fql, handleGetAlbumsResponse); }
private function handleGetAlbumsResponse(albums:Object, fail:Object):void {
//Alert.show('handleGetAlbumsResponse : '+(albums==null)?"empty":"non-empty");
if (albums != null)
facebookPhotoAlbums = new ArrayCollection(albums as Array);
else
Alert.show("Error in albums"); }
private function showSelectedAlbum():void {
var fql:String = "select pid,src_big, src_small from photo where aid = '" + albumCombo.selectedItem.aid + "'";
Facebook.fqlQuery(fql, handleGetPhotosResponse); }
private function handleGetPhotosResponse(photos:Object, fail:Object):void {
if (photos != null)
{
facebookPhotos = new ArrayCollection(photos as Array);
//Alert.show('facebookPhotos : \n\n\n'+JSON.encode(facebookPhotos));
Global.facebookArr.removeAll();
for each(var obj:Object in facebookPhotos)
{
var o:Object = new Object();
o.imgCatId = "facebook";
o.imgSubCatId = obj.pid;
o.small = obj.src_small;
o.large = obj.src_big;
o.maxW = 400; //default size is 400 X 500
o.maxH = 500;
o.available = false;
Global.facebookArr.addItem(o);
}
imagePage.dataProvider = Global.facebookArr;
}
else
Alert.show("Error in photos"); }
public var myTip:ToolTip; private function createBigTip(str:String,event:MouseEvent):void {
var p:Point = new Point();
p = event.target.localToGlobal(new Point(event.target.parent.x,event.target.parent.y));
myTip = ToolTipManager.createToolTip(str,p.x+40,p.y+30,'errorTipBelow') as ToolTip;
//myTip.setStyle("styleName", "errors"); }
private function destroyBigTip():void {
if(myTip)
ToolTipManager.destroyToolTip(myTip); }
private var exixts:Boolean;
private function submitFromFB(event:MouseEvent):void {
for each(var obj:Object in Global.facebookArr)
{
exixts = false;
if(obj.available)
{
if(Global.ImageArr.length>0)
{
for each(var o:Object in Global.ImageArr)
{
if(obj.imgSubCatId == o.imgSubCatId)
{
exixts = true;
break;
}
}
}
if(!exixts)
Global.ImageArr.addItemAt(obj,0);
}
}
logout();
PMSocial.remove(); }
]]> </mx:Script>
<mx:HBox borderStyle="solid" width="100%" verticalAlign="middle"> <mx:Button label="Login" click="login()" rollOver="createBigTip(btn1Info,event)" rollOut="destroyBigTip()" styleName="socialBtn" width="125" height="25"/> <mx:Button label="Logout" click="logout()" rollOver="createBigTip(btn2Info,event)" rollOut="destroyBigTip()" styleName="socialBtn" width="125" height="25"/> <mx:Spacer width="100%"/> <mx:Label text="Welcome, " fontSize="13" fontFamily="Droid Sans"/> <mx:Label id="nameLbl" text="Guest" fontSize="13" fontFamily="Droid Sans"/> <!--<mx:Button label="3. Browse Photos" click="getPhotoAlbums()" rollOver="createBigTip(btn3Info,event)" rollOut="destroyBigTip()"/>--> <!--<mx:Image id="userImg" top="171" width="50" height="50" left="10"/>--> </mx:HBox> <!--<mx:Label id="status" text="Status Message : Please log in" />--> <mx:ComboBox id="albumCombo" textAlign="left" styleName="ComboBox11" prompt="Select Album" dataProvider="{facebookPhotoAlbums}" change="showSelectedAlbum()" labelField="name"/> <mx:VBox height="100%" width="100%" paddingTop="3" verticalGap="0"> <mx:Label id="l1" text="Check images you want to upload, Please click on images you want to use" fontFamily="Droid Sans" fontSize="13"/> <mx:TileList id="imagePage" height="100%" width="100%"
columnCount="5"
selectionColor="0xFFFFFF" rollOverColor="0xFFFFFF"
rowHeight="150" borderStyle="solid" paddingBottom="-4"> <mx:itemRenderer>
<mx:Component>
<view:ManageClipart/>
</mx:Component> </mx:itemRenderer> </mx:TileList> <mx:Canvas width="100%"> <mx:Button id="submit" right="0" label="Submit" styleName="yesbtn"
useHandCursor="true" buttonMode="true" click="submitFromFB(event)"/> </mx:Canvas>
</mx:VBox> </mx:VBox>
希望它会有所帮助,alto这个api确实给了一个巨大的折磨,哈哈,一切顺利