开发者

What is the best way to OAuth twitter without use of a proxy server or server-side script in a Flash As3 Web Application?

I can't use a proxy server. Can't use google app engine etc.

I can't use server side code. No php or python.

I need to be able to do logins to twitter and post statu开发者_Go百科s updates to twitter through an Actionscript 3 web application.

The biggest thing is obviously getting around twitter's crossdomain. Is there a clean ajax version of this or something?

Thanks for the help!


I have had some luck using jQuery to load a feed into flash using:

JS

var flashObj;

$(document).ready(function() {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        flashObj = window["adidasFlash"];
    } else {
        flashObj = document["adidasFlash"];
    }
});

function loadTwitterFeed(screenName) {
    $.getJSON("http://api.twitter.com/1/statuses/user_timeline.json?screen_name="+screenName+"&callback=?", function(data) {
        console.log(data);
        flashObj.tweetLoadComplete(data);
    });
}

AS

ExternalInterface.addCallback("tweetLoadComplete", tweetLoadComplete);
loadFeed("BarackObama");

function loadFeed(screenName:String):void {
       ExternalInterface.call("loadTwitterFeed", screenName);
}

function tweetLoadComplete(obj:Object):void {
       for each (var o:Object in obj) {
              trace(o.text);
       }
}

Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜