我們已經解決了這個問題,
這是我們的源代碼看起來像我們授權api並獲取/顯示推文的一個例子。
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="TOUS ENSEMBLE"
initialize="init()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:ArrayCollection id="tweets" />
</fx:Declarations>
<s:states>
<s:State name="normal" />
<s:State name="busy"/>
<s:State name="networkError"/>
</s:states>
<s:List id="list" top="0" left="0" right="0" bottom="0" dataProvider=" {tweets}">
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<s:Image source="{data.user.profile_image_url}" left="0" verticalCenter="0" width="60" height="60"/>
<s:Label text="{data.text}" left="65" right="5" top="5" bottom="5"/>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
<s:BusyIndicator id="busy" verticalCenter="0" horizontalCenter="0" width="60" height="60" includeIn="busy"/>
<s:Label id="networkError" verticalCenter="0" horizontalCenter="0" text="Network Error Occured" includeIn="networkError"/>
<fx:Script>
<![CDATA[
import de.danielyan.twitterAppOnly.TwitterSocket;
import de.danielyan.twitterAppOnly.TwitterSocketEvent;
private var _twitter:TwitterSocket;
private var searchTweetKeyword;
public function init():void
{
_twitter = new TwitterSocket('I9ItnPjy670SsLOBcas5pJHGY', 'GpuPGqrCfRm53LpayKOVtGjdOFZNY3mTycQHJc2vf3SAeXDqME');
// twitter socket uses two events:
_twitter.addEventListener(TwitterSocket.EVENT_TWITTER_READY, onTwitterReady);
// * The Twitter Data event, when the twitter Request has finished
_twitter.addEventListener(TwitterSocket.EVENT_TWITTER_RESPONSE, onTwitterData);
// * Catch IO Errors! This happens when no network is available
_twitter.addEventListener(IOErrorEvent.IO_ERROR,onError);
currentState="busy";
}
public function onError(event:Event):void
{
currentState="networkError";
}
public function onTwitterReady(event:Event):void
{
_twitter.request("/1.1/search/tweets.json?q=#belgianreddevils");
}
public function onTwitterData(event:TwitterSocketEvent):void
{
// this message is
currentState="normal";
var tweetList = new ArrayCollection(event.response.statuses as Array);
//tweets = new ArrayCollection(event.response.statuses as Array);
trace(tweetList[0].text);
tweets = tweetList;
}
]]>
</fx:Script>
</s:View>
我們使用來自我已經包括了PDF格式,這github上文檔 https://github.com/denisdanielyan/as3-Application-Only-Twitter
向我們展示你已經嘗試了源代碼的幫助。 – 2015-01-10 10:16:56