dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: What is wrong with this code??? Trying to paste a link object on facebook using as3.

Hybrid View

  1. #1
    Senior Member
    Join Date
    Sep 2006
    Posts
    248

    What is wrong with this code??? Trying to paste a link object on facebook using as3.

    Hello everyone, for the last 3 days i have been trying to paste a link on facebook using a simple app that i created. Just to test how is dealing with facebook using as3. But still cant paste a simple link object. Any ideas?
    Regards,
    Leo.
    Here is the code:

    Code:
    import com.facebook.graph.Facebook;
    import com.facebook.graph.data.FacebookSession;
    import flash.events.Event;
    
    b_1.addEventListener(MouseEvent.MOUSE_DOWN, onClick);
    b_2.addEventListener(MouseEvent.MOUSE_DOWN, onStart);
    b_3.addEventListener(MouseEvent.MOUSE_DOWN, myPost);
    
    b_2.visible = false;
    b_3.visible = false;
    function onClick(e:Event):void
    {
        Facebook.init("xxx", onFacebookInit);
        b_2.visible = true;
    }
    function onFacebookInit(session:FacebookSession, error:Object):void
    {
        if (session)
        {
            status_1.text = "Sucesso init";
        }
        else
        {
            status_1.text = "ERRO init";
        }
        status_1.text = "algo";
    }
    
    
    function onStart(e:Event):void
    {
        var requiredPermissions = new Array();
        requiredPermissions.push("user_about_me");
        requiredPermissions.push("publish_stream");
        
        var options:Object = new Object();
        options.perms = requiredPermissions.toString();
        
        Facebook.login(onFacebookLogin, options);
        b_3.visible = true;
    }
    
    function onFacebookLogin(success:Object, fail:Object):void
    {
        if (success)
        {
            status_2.text = "Sucesso Login";
        }
        else
        {
            status_2.text = "ERRO Login";
        }
        status_1.text = "algo 2";
    }
    
    function myPost(e:Event):void
    {
            var options:Object = new Object();
            options.name = "I found it!!!";
            options.caption = "Found it";
            options.description = "I found what i was looking while using this app!";
            options.link = "http://apps.facebook.com/xxx/";
            options.picture = "http://www.xxx.com/fb_tests/logo_ct.jpg";
            Facebook.api("me/feed", responseHandler, options, "post");
    }
    
    function responseHandler(success:Object, fail:Object):void
    {
        if (success && success.id)
        {
            
        }
    }

  2. #2
    Senior Member somlemeg's Avatar
    Join Date
    Aug 2000
    Posts
    168
    Perhaps it has to do with one of the latest security updates for flash? Perhaps you should you consider implementing some javascript to support the flash code.

    Just noticed that this simple code does not work under chrome:

    Code:
    btn1.addEventListener(MouseEvent.CLICK,goThere);
    function goThere(e:MouseEvent){
    	var myRequest:URLRequest = new URLRequest("http://www.facebook.com/sharer.php?u=http://www.google.com");
    	navigateToURL(myRequest, "_self");
    }
    Last edited by somlemeg; 11-06-2012 at 03:33 PM.

  3. #3
    Senior Member
    Join Date
    Sep 2006
    Posts
    248
    Hello Somlemeg,
    Thanks for the reply. Looks like there is no way to create a Facebook App using just AS3.
    Tried, searched, and didnt find much examples or code to try...
    :-(
    Thanks anyway.
    Regards.
    Leo.

  4. #4
    Senior Member
    Join Date
    Sep 2006
    Posts
    248
    Hello Somlemeg,
    Thanks for the reply. Looks like there is no way to create a Facebook App using just AS3.
    Tried, searched, and didnt find much examples or code to try...
    :-(
    Thanks anyway.
    Regards.
    Leo.

  5. #5
    Senior Member somlemeg's Avatar
    Join Date
    Aug 2000
    Posts
    168
    I haven't tried it myself, but here is an example how to create using AS3 according to adobe:

    http://cookbooks.adobe.com/post_Face...ava-17581.html

  6. #6
    Senior Member
    Join Date
    Sep 2006
    Posts
    248
    Thanks a lot...
    gonna take a look at that...
    But looks like its not easy to find tutorials about the same topic.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center