tumblrの投稿を表示するテスト。


umhr_tumblrtumblr投稿を表示するテスト。

▼Wonderfl

▼ActionScript AS3(FP9)
[sourcecode language=”as3″]
/*
tumblrの投稿を表示するテスト。

* */

package
{
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.text.TextField;
import flash.filters.DropShadowFilter;

/**
* …
* @author umhr
*/
public class Main extends Sprite
{

public function Main():void
{
var myLoader:URLLoader = new URLLoader();
myLoader.addEventListener (Event.COMPLETE,COMPLETE);
myLoader.load(new URLRequest("http://umhr.tumblr.com/api/read/?filter=text&id=162581624"));
var myLoader2:URLLoader = new URLLoader();
myLoader2.addEventListener (Event.COMPLETE,COMPLETE2);
myLoader2.load(new URLRequest("http://umhr.tumblr.com/api/read/?id=162628316"));
}

private function COMPLETE(e:Event):void
{
var xml:XML = new XML(e.currentTarget.data);
var myTitle:TextField = new TextField();
myTitle.text = xml.posts.post["regular-title"];
myTitle.width = 465;
myTitle.height = 30;
addChild(myTitle);
var myBody:TextField = new TextField();
myBody.text = xml.posts.post["regular-body"];
myBody.width = 465;
myBody.height = 435;
myBody.y = 30;
addChild(myBody);
}
private function COMPLETE2(e:Event):void
{
var xml:XML = new XML(e.currentTarget.data);
trace(xml)
var myLoader:Loader = new Loader();
myLoader.load(new URLRequest(xml.posts.post["photo-url"][0]));
addChildAt(myLoader,0);
}
}
}
[/sourcecode]