yahoo pipesからのデータがsecurity sandbox 侵害になる件
♥0 |
Line 31 |
Modified 2010-06-09 20:44:04 |
MIT License
archived:2017-03-20 08:12:56
ActionScript3 source code
/**
* Copyright sinketu ( http://wonderfl.net/user/sinketu )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pj0H
*/
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class FlashTest extends Sprite {
private var myLoader:URLLoader = new URLLoader();
public var myArray:Array = new Array();
public function FlashTest() {
// yahoo pipesのテスト1
//security sandbox 侵害になるのがなぜかわかった。
myLoader.addEventListener (Event.COMPLETE,COMPLETE);
//yahoo pipesが吐き出すアドレスの"http://pipes.yahoo.com/"を"http://pipes.yahooapis.com/"にかえなきゃなんない。
//myLoader.load(new URLRequest("http://pipes.yahoo.com/pipes/pipe.run?_id=febf0c71127b8a1538ebe52fb5b30878&_render=json&_rand="+Math.random()));
myLoader.load(new URLRequest("http://pipes.yahooapis.com/pipes/pipe.run?_id=755b773d73a8faef78c9dd5a6dfff220&_render=rss&_rand="+Math.random()));
}
private function COMPLETE(e:Event = null):void
{
var myXML:XML = new XML(myLoader.data);
for each (var prop:XML in myXML.channel[0].item.title) {
myArray.push(prop);
}
myArray.reverse();
var myTextField:TextField=new TextField();
myTextField.width=450;
myTextField.autoSize=TextFieldAutoSize.LEFT;
myTextField.wordWrap=true;
addChild(myTextField);
myTextField.text=myArray.toString();
}
}
}