forked from: Google AJAX Search APIを使ってみる
Google AJAX Search APIを使ってみる!
こんな感じであってる?
// forked from paq's Google AJAX Search APIを使ってみる
//
//Google AJAX Search APIを使ってみる!
//こんな感じであってる?
//
package {
import flash.display.*;
import flash.events.*;
import flash.xml.*;
import flash.net.*;
import flash.text.*;
import flash.utils.escapeMultiByte;
import com.adobe.serialization.json.*;
public class Main extends MovieClip{
private var loader:URLLoader = new URLLoader();
public function Main():void {
Wonderfl.capture(stage);
loader.load(new URLRequest("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+escapeMultiByte("kardashian")+"&rsz=large"));
loader.addEventListener(Event.COMPLETE,loadComplete);
}
private function loadComplete(e:Event):void {
var json:Object = JSON.decode(e.target.data as String);
var tf:TextField = new TextField();
tf.width = 465; tf.height = 465
addChild(tf);
for(var i:uint = 0; i < 8; i++){
tf.text = tf.text + json.responseData.results[i].titleNoFormatting + "\n" +json.responseData.results[i].unescapedUrl + "\n\n";
}
}
}
}