10 Replies Latest reply on Aug 3, 2012 7:06 AM by kglad

    Image post in Facebook wall

    A.kameshwaran Level 1

      Hi,

             I would like to know, how can i post the image in facebook and google+ via my flash interface developed in AS2. Any ideas will be pretty much helpful for my developement as i don't have any idea of doing it.

       

      I have created the site and user can upload the files from his desktop. my pendig part is, if user wants to post a image from his uploaded photo, he needs to have a option for that.

       

      Kindly help me out.

       

      Regards,

      Kameshwaran A.

        • 1. Re: Image post in Facebook wall
          kglad Adobe Community Professional & MVP

          after logging in the user, you can use (with the externalinterface class in flash to call feedF and receive the return from fb by defining swfF) the following javascript:

           

          function feedF(){
              var obj = {
                method: 'feed',
                link: 'http://www.kglad.com/Files/fb',
                picture: 'http://www.kglad.com/Files/fb/game_01.jpg',
                name: 'game_01 feed test',
                caption: 'game_01',
                description: 'game_01 feed dialog.'
              };

           

              FB.ui(obj, function(response){
                  toSWF("feed response **");
                  evalF(response);
              });
          }
          function evalF(obj){
              if(typeof obj == "object"){
                  for(var s in obj){
                      toSWF(s);
                      evalF(obj[s]);
                  }
              }  else {
                  toSWF(obj);
              }
          }

           

           

               function thisMovie(movieName) {

                   if (navigator.appName.indexOf("Microsoft") != -1) {

                       return window[movieName];

                   } else {

                       return document[movieName];

                   }

               }

               function toSWF(value) {

                   thisMovie("game_01").swfF(value);  // use your swf's name

               }

          1 person found this helpful
          • 2. Re: Image post in Facebook wall
            A.kameshwaran Level 1

            Thanks for the response. How can i send the multiple argument to the feedF() in the below ExternalInterface call

             

            ExternalInterface.call("feedF", link);

             

            As i am planning to send the below values dynamically. Also, is the below arguments are must for posting the image in a wall.

             

            ar obj = {
                  method: 'feed',
                  link: 'http://www.kglad.com/Files/fb',
                  picture: 'http://www.kglad.com/Files/fb/game_01.jpg',
                  name: 'game_01 feed test',
                  caption: 'game_01',
                  description: 'game_01 feed dialog.'
                };

             

             

            Kindly suggest even if i am wrong.

            • 3. Re: Image post in Facebook wall
              kglad Adobe Community Professional & MVP

              just pass whatever arguments you want to use:

               

              function feedF(linkS,imageS);

               

              ar obj = {

              method: 'feed',

              link: linkS,

              picture: imageS,

              name: 'game_01 feed test',

              caption: 'game_01',

              description: 'game_01 feed dialog.'

              };


              }

              1 person found this helpful
              • 4. Re: Image post in Facebook wall
                A.kameshwaran Level 1

                Below is my code and i couldn't able to find the problem, Kindly help me out

                 

                JS:

                 

                <script type="text/javascript">

                 

                              function feedF(){

                                //alert("HI");

                                var obj = {

                                method: 'feed',

                                link: 'http://localhost/working/webcam/images',

                                picture: 'http://localhost/working/webcam/images/27-6-2012-12-54-43.jpg',

                                name: 'img feed test',

                                caption: 'img',

                                description: 'img feed dialog.'

                                };

                                FB.ui(obj, function(response){

                                        toSWF("feed response **");

                                        evalF(response);

                                    });

                                }

                            function evalF(obj){

                                if(typeof obj == "object"){

                                    for(var s in obj){

                                        toSWF(s);

                                        evalF(obj[s]);

                                    }

                                }  else {

                                    toSWF(obj);

                                }

                            }

                            function thisMovie(movieName) {

                             if (navigator.appName.indexOf("Microsoft") != -1) {

                                 return window[movieName];

                             } else {

                                 return document[movieName];

                             }

                         }

                 

                         function toSWF(value) {

                             thisMovie("facebook").swfF(value);  // use your swf's name

                         }

                        </script>

                 

                AS

                 

                import flash.external.ExternalInterface;

                f_btn.onPress = function()

                {

                    ExternalInterface.call("feedF", retText);

                }

                 

                 

                Correct me where i am wrong.

                • 5. Re: Image post in Facebook wall
                  kglad Adobe Community Professional & MVP

                  you're sending a variable to feedF but feedF does not accept a parameter.  fix that.

                  1 person found this helpful
                  • 6. Re: Image post in Facebook wall
                    A.kameshwaran Level 1

                    import flash.external.ExternalInterface;

                    f_btn.onPress = function()

                    {

                        ExternalInterface.call("feedF");

                    }

                     

                    I have checked,on click of the button, alert inside the function is triggering. but still it is not posting the image content.

                    • 7. Re: Image post in Facebook wall
                      kglad Adobe Community Professional & MVP

                      did you login the user and get permission to post to their wall?

                      • 8. Re: Image post in Facebook wall
                        A.kameshwaran Level 1

                        I have login to my account. But i didn't get the permission to post in the wall. Because i have no idea about this topic. Kindly guide me.

                        • 9. Re: Image post in Facebook wall
                          A.kameshwaran Level 1

                          How to get the permission to post image in my wall. Also, if there is no permission then, i needs to have some msg stating that permission is not there. I am not getting that msg too. Kindly guide me or give me some technical hints... I am really in very critical mode to complete the task.

                          • 10. Re: Image post in Facebook wall
                            kglad Adobe Community Professional & MVP

                            you should use something like the following to login the user:

                             

                              (function(d, s, id) {

                                    var js, fjs = d.getElementsByTagName(s)[0];

                                    if (d.getElementById(id)) return;

                                    js = d.createElement(s); js.id = id;

                                    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=229095550543776";

                                    fjs.parentNode.insertBefore(js, fjs);

                                }(document, 'script', 'facebook-jssdk'));

                             

                                // initialize with fb js (after it loads) with your App ID

                                window.fbAsyncInit = function() {

                                  FB.init({

                                    appId      : 'YOUR APP ID',

                                    status     : true, // check login status

                                    cookie     : true, // enable cookies to allow the server to access the session

                                    xfbml      : true  // parse XFBML

                                  });

                                  // fbLoginStatus is called when there is a login status change and when fb js initializes

                                  function fbLoginStatus(response) {

                                      // If the user is logged in, response.status is 'connected'

                                      if (response.status === 'connected') {

                                        FB.api('/me', function(response) {

                                            toSWF("is connected:: "+response.status);

                                            evalF(response);

                                        });

                                      } else {

                                          // The user is not logged-in.

                                          toSWF("not connected:: "+response.status);

                                          evalF(response);

                                      }

                                  }

                                  // This is the code that calls fbLoginStatus on initialization

                                  FB.getLoginStatus(fbLoginStatus);

                                  // This is the code that call fbLoginStatus when there is a status change

                                  FB.Event.subscribe('auth.statusChange', fbLoginStatus);

                                };

                             

                            // and you can use the following to request permissions.  the permissions are hard-coded below but you may want to pass a parameter to permissionsF if you want flexibility here:

                             

                            function permissionsF(){
                                var obj = {
                                    method: 'permissions.request',
                                    perms: 'user_birthday,user_relationship_details,read_stream',
                                    display: 'popup'
                                };
                                FB.ui(obj, function(response) {
                                     toSWF("permissions **");
                                     evalF(response);
                                });
                            }

                             

                            p.s.  please mark helpful/correct responses.

                            1 person found this helpful