Twitter TEST
Twitterからの情報読み込みテスト
/**
* Copyright swordmaster77 ( http://wonderfl.net/user/swordmaster77 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pgpk
*/
/*
Twitterからの情報読み込みテスト
*/
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class twitterReadTest extends Sprite {
private var textField:TextField;
public function twitterReadTest():void {
var xmlURL:String = "http://swordmaster.sitemix.jp/crossdomain-proxy.php?url=http://twitter.com/statuses/user_timeline.xml?screen_name=555hamako";
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
xmlLoader.load(new URLRequest(xmlURL));
//TITLEセット
var titleField:TextField = new TextField();
titleField.text = "ハマコーさんのつぶやき";
titleField.autoSize=TextFieldAutoSize.LEFT;
addChild(titleField);
titleField.x = 0;
titleField.y = 0;
}
public function loadXML(e:Event):void
{
var twitterText:String;
var xml:XML = new XML(e.target.data);
var items:XMLList = xml.children();
for(var i:int = 0; i < items.length(); i++){
twitterText += items[i].text;
twitterText += "\n";
}
textField = new TextField();
textField.text = twitterText;
textField.autoSize=TextFieldAutoSize.LEFT;
addChild(textField);
textField.x = 0;
textField.y = 20;
}
}
}