[Facebook]How to pass data from php to flash?
Hi, i am a beginner in PHP n Flash.
My question is how to display Facebook logged in username and profile image into Flash by using Flashvar??
Here is the php code please check whether it is correct or not?
PHP Code:
<?php
//include facebook api etc.
require_once("facebook/facebook.php");
//create new facebook instance
$facebook = new Facebook('xxx', 'xxx');
//prompt the user to login
$fb_user = $facebook->require_login();
//check if the user has added the app
if (!$facebook->api_client->users_isAppUser()) {
//if not, redirect him to add it
$facebook->redirect($facebook->get_add_url());
}
//select the profile image
$photoData = $facebook->api_client->users_getInfo($fb_user, 'pic_big');
$photo = $photoData[0]['pic_big'];
//select the profile name
$tmp=$facebook->api_client->fql_query("SELECT name FROM user WHERE uid=$user");
$nam=$tmp[0]["name"];
?>
<!-- flash file -->
<fb:swf swfsrc='http://xxx/app/fbtest.swf' allowscriptaccess='never' bgcolor='#ffffff' wmode='transparent' flashvars='u_img=<?php echo urlencode($photo);?>& u_name=<?php echo urlencode($nam);?>' width='500' height='400'/>
And for the Flash part i do not know how to write the code into it.
The component i will be using is UILoader for the Image and Textfield for name.
Please kindly help me out.
Thankyou.