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.
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
}
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.
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.
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. ![]()
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.
North America
Europe, Middle East and Africa
Asia Pacific