Hello, I am using this code, can't really also release the asp script(license) that this code requires for the database connections but you get the idea:
mssqlQuery("SELECT * FROM Test_Locations WHERE FID = '"+ MFID +"'","GetFriendInfo");
public function mssqlQuery(sql:String,fid:String):void { var http:HTTPService = new HTTPService; var parm:Object = new Object; parm.fas_sql = sql; parm.fas_db = mssql_db; http.url = mssql_url+"?irand="+Math.random(); http.showBusyCursor = true; http.request = sql; http.addEventListener(ResultEvent.RESULT, mssqlResult); http.addEventListener(FaultEvent.FAULT, mssqlFault); http.method = "POST"; sqlToken = http.send(parm); sqlToken.param = fid; } private function mssqlFault(event:FaultEvent):void { var err:String = event.fault.faultString; trace(err); } /******************************************************** * mssqlResult() should be used to handle all of the * returns of your queries. This will end up being a * long case list. * *********************************************************/ private function mssqlResult(event:ResultEvent):void{ //Note: All Results are stored in the // event.result object //Create a new case/break for each of your //sql query statements var directionList:ArrayCollection; var countdrac:int = 0; switch(event.token.param){ case "GetFriendInfo": if (event.result && event.result.results && event.result.results.record && (event.result.results.record.length > 0)){ FriendsPopMap(currentuserhandling.name, "http://graph.facebook.com/"+currentuserhandling.id+"/picture", event.result.results.record.Place, event.result.results.record.Personal, event.result.results.record.CurrentUpdateInterval) currentuserhandling = null; trace("ran"); } break; case "SetMyInfo": //just sends data out no response needed break; } }
The problem is that the mssqlQuery is called from a 'for each' statement that reads from facebook API(gets facebook id's from all of your friends), then if the FID(their facebook ID) is in my database it will mark them on a map(FriendsPopMap), the problem is that since the mssqlQuery takes more time I can't store the current other userinfo(that comes from facebook) in currentuserhandling as the facebook runs faster then the mssqlQuery, I wan't to maybe add parameters to the mssqlQuery and also the mssqlResult so it can get the extra data from facebook, that is not stored in my database(script above only connects to my database).
Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.
http://code.google.com/p/facebook-actionscript-api/