1 / 10

Introduction to opensocial-actionscript-client

Introduction to opensocial-actionscript-client. Sung Wu Aaron Tong 2009/03/20. Agenda. Intro Architecture Code-sample Resource. A Flex library for accessing OpenSocial API OpenSocial 0.81 AS3 Opensource. http://code.google.com/p/opensocial-actionsctip-client. Introduction.

Download Presentation

Introduction to opensocial-actionscript-client

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to opensocial-actionscript-client Sung Wu Aaron Tong 2009/03/20

  2. Agenda • Intro • Architecture • Code-sample • Resource

  3. A Flex library for accessing OpenSocial API OpenSocial 0.81 AS3 Opensource http://code.google.com/p/opensocial-actionsctip-client Introduction

  4. Architecture OpenSocial Container Browser OpenSocial Gadget Dynamically Generated javascript Your swf Javascript API

  5. Design Decisions • Uses OpenSocial Javascript API instead of OpenSocial REST spec • Crossdomain.xml restrictions on some containers • REST not implemented yet on some containers • Dynamic Javascript injection • Simple deployment • Interface: follows OpenSocial Javascript API • Easy to understand if you come from the normal OpenSocial development world. Follows the standard.

  6. Initialization <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> …. private function init():void { //create the Container container = Container.instance; container.setContainer(new StandardContainer()); }

  7. Code sample: update data private function updateData():void{    var dr:DataRequest = container.newDataRequest();    dr.add(dr.newUpdatePersonAppDataRequest("VIEWER", "testdatakey1", 'test'));    dr.send(updatePersonAppDataCallback);}private function updatePersonAppDataCallback(dataResp:DataResponse):void {    Alert.show("updatePersonAppDataCallback().  \n dataResp.hadError()=" + dataResp.hadError()               + "\n dataResp.getErrorMessage()=" + dataResp.getErrorMessage());}

  8. Code Sample: fetch data private function fetchData():void{    var dr:DataRequest = container.newDataRequest();    var idSpecParam:Object = {};    idSpecParam[com.nextgenapp.opensocial.IdSpec.Field.USER_ID] = "VIEWER";    var idSpec:IdSpec = container.newIdSpec(idSpecParam); dr.add(dr.newFetchPersonAppDataRequest(idSpec, ["testdatakey1"], null), opt_key);     dr.send(fetchPersonAppDataCallback); }private function fetchPersonAppDataCallback(dataResp:DataResponse):void {    if (dataResp.hadError()) {        Alert.show("error: " + dataResp.getErrorMessage());    }    var appData:Object = dataResp.get("data").getData();    Alert.show("appData=" + appData);    // appData should have a member (user's id).  inside that, it should have a member    var appDataDisplay:String = "";    for (var propNameLevel1:String in appData) {        appDataDisplay += ("\n" + propNameLevel1 + " : " + appData[propNameLevel1]);        for (var propNameLevel2:String in appData[propNameLevel1]) {            appDataDisplay += ("\n----" + propNameLevel2 + " : " + appData[propNameLevel1][propNameLevel2]);        }    }    Alert.show("appData expanded=" + appDataDisplay);}

  9. Resource • Project site: http://code.google.com/p/opensocial-actionscript-client • Blog: http://opensocial-actionscript-client.blogspot.com • Group: http://groups.google.com/group/opensocial-actionscript-client • Contact: Sung Wu apiswswsw@gmail.com

  10. Status • Several major API functions are implemented. Still under development to cover all API functions

More Related