facebook actionscript api

Today i'm working on a new Adobe flash builder 4.5 mobile and facebook application. to minimize my task i googled for facebook actionscript api and found a good actionscritpt opensource resource in google codes. so i'm shearing it here in my blog. Google code page here
Frends List Example


package {

import com.facebook.graph.FacebookDesktop;
import com.facebook.graph.net.FacebookRequest;

import flash.events.EventDispatcher;

import mx.collections.ArrayList;

public class FriendsModel extends EventDispatcher {

protected var friendsHash:Object;
protected var friendsArrayList:ArrayList;

public function FriendsModel() {
super();

friendsHash = {};
friendsArrayList = new ArrayList();
}

public function get dataProvider():ArrayList {
return friendsArrayList;
}

public function load():void {
FacebookDesktop.api('/me/friends', handleFriendsLoad);
}

protected function handleFriendsLoad(response:Object, fail:Object):void {
friendsArrayList.removeAll();
if (fail) { return }
var friendsIds:Array = [];

var friends:Array = response as Array;

var l:uint=friends.length;
for (var i:uint=0;i

facebook api php get friends

Here is a small php examples to get all the friends with php and facebook API

FQL Query to get all friends
SELECT uid, name, pic_square FROM user WHERE uid = me()
OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())

Using GRAPH API
https://graph.facebook.com/me/friends?access_token=YOUR_ACCESS_TOKEN

this will return all your friends list.After getting the friends list you can use folowing script to loop through the returened Array

foreach ($friends as $key=>$value) {
echo count($value) . ' Friends';
echo '<hr />';
echo '<ul id="friends">';
foreach ($value as $fkey=>$fvalue) {
echo '<li><img src="https://graph.facebook.com/' . $fvalue[id] . '/picture" title="' . $fvalue[name] . '"/></li>';
}
echo '</ul>';
}

Access Camera with Actionscript in Android and Iphone

This is a simple example to Access Camera with Actionscript In Android and I phone.

First we need to set the proper permission for our application for access Camera(android only).
Specify Android specific tags to AndroidManifest.xml
<uses-permission name="android.permission.CAMERA">

private var camera:CameraUI;
protected function application1_applicationCompleteHandler(event:FlexEvent):void {
if (CameraUI.isSupported){
camera = new CameraUI();
camera.addEventListener(MediaEvent.COMPLETE, onComplete);
camera.addEventListener(ErrorEvent.ERROR, onError);
status.text="CameraUI supported";
} else {
status.text="CameraUI NOT supported";
}
}
private function captureImage(event:MouseEvent):void {
camera.launch(MediaType.IMAGE);
}
private function onError(event:ErrorEvent):void {
trace("error has occurred");
}

actionscript svg parser

"as3svgrendererlib" Is a great Lib written in actionscript 3.0 . It very easy to use library. But still there are limitations for this lib.

Try http://as3svgrendererlib.googlecode.com

Google webfonts

Google webfonts Sounds good. It's a great collection of open-source fonts optimized for the web.

How to use

1 Select the Font you want to use in your web page
2 Choose the characters you want
3 Add this code to your website;

A sample is bellow




http://www.google.com/webfonts

http://code.google.com/apis/webfonts/docs/getting_started.html

Mobile Web Viewport META Tag

Past few days i was tying to develop a mobile FB app for Android and Iphone.The hardest part in this application i feel is The UI . I spend almost 3 days to get the UI work proper. First i Used jQuery mobile Frame work; the frame work is cool but the documentation is very poor. $.mobile.ajaxEnabled function is never going to work.finaly i edit the source code and changed the ajaxEnabled=true to false :) . The next issue was the page size it render in different size in different browsers. an that was the hard part for me i don't see any solutions in jquery mobile site. after gogling an hour i fond a solution in mozilla web site . This will make jquery mobile full page and proper size.

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
this meta tage is great and it solved my UI issue some usefull mobile meta tags bellow .

META directive Example Value Description
width width=320
width=device-width
Logical width of the viewport, in pixels. The special device-width value indicates that the viewport height should be the screen width of the device.
height height=480
height=device-height
Logical height of the viewport, in pixels. The special device-height value indicates that the viewport height should be the screen height of the device.
user-scalable user-scalable=no Specifies whether the user can zoom in and out of the viewport Possible values are yes or no.
initial-scale initial-scale=2.0 Sets the initial scaling or zoom factor used for viewing a Web page.
maximum-scale maximum-scale=2.5 Sets the user’s maximum limit for scaling or zooming a Web page.
minimum-scale minimum-scale=0.5 Sets the user’s minimum limit for scaling or zooming a Web page.

References

http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html

https://developer.mozilla.org/en/mobile/viewport_meta_tag

Amazon SES integration services

I have integrated several opensource softwares with amazon ses bulk mail service. If you need to integrate your custom script or software to talk to amazon SES, contact me.


PHP developer Cochin |PHP developer Kerala | PHP developer India | Flash developer/programmer Cochin | Flash developer/programmer Kerala | Flash developer/programmer India | web programmer kerala |web programmer Cochin |web programmer India |web developer kerala |Web developer Cochin | Kerala PHP | PHP freelancer| flash actionscript freelancer