Wednesday, May 16, 2012

[Action Script] Facebook Mobile API, uploading photo May,2012

ActionScript Code: import com.facebook.graph.FacebookMobile;import flash.geom.Rectangle;import flash.media.StageWebView;import flash.net.URLRequestMethod;FacebookMobile.init("my app id", afterInit);function afterInit(a:*,b:*):void{    var stageweb:StageWebView = new StageWebView();    stageweb.stage = this.stage;    stageweb.viewPort = new Rectangle(230,120,400,500);    FacebookMobile.login(this.afterLogin, this.stage, ["publish_stream", "user_photos"], stageweb);}share.addEventListener(MouseEvent.MOUSE_DOWN, sharebuttonHandler);function sharebuttonHandler(event:MouseEvent):void{    var bd:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight);        bd.draw(stage);        var screenshot:Bitmap = new Bitmap(bd);        screen.source = screenshot;                var params:Object = { image:screenshot, message:'Test Photo', fileName:'FILE_NAME' };        FacebookMobile.postData("/me/photos", null, params);}function afterLogin(success:*, b:*):void{    if (success)    {        username.text = success.user.name;        userImg.source=FacebookMobile.getImageUrl(success.uid,"small");            }}

i need help with posting a photo to facebook.

i know this part is totally wrong, im not sure how to get it to work:

var params:Object = { image:screenshot, message:'Test Photo', fileName:'FILE_NAME' };
FacebookMobile.postData("/me/photos", null, params);

id appreciate the help, thanks.


well it actually works, although i get this error output:

TypeError: Error #1006: value is not a function.
at com.facebook.graph.core::AbstractFacebook/handleRequestLoad()[C:\Users\facebookGraphApi\api\com\facebook\graph\c ore\AbstractFacebook.as:245]
at com.facebook.graph.net::AbstractFacebookRequest/dispatchComplete()[C:\Users\facebookGraphApi\api\com\facebook\graph\n et\AbstractFacebookRequest.as:290]
at com.facebook.graph.net::AbstractFacebookRequest/handleDataLoad()[C:\Users\facebookGraphApi\api\com\facebook\graph\n et\AbstractFacebookRequest.as:272]
at com.facebook.graph.net::AbstractFacebookRequest/handleURLLoaderComplete()[C:\Users\facebookGraphApi\api\com\facebook\graph\n et\AbstractFacebookRequest.as:248]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Facebook Mobile API, uploading photo

Related Post



0 comments: