flash on 2009-11-3
♥0 |
Line 56 |
Modified 2009-11-03 23:09:19 |
MIT License
archived:2017-03-20 07:55:30
ActionScript3 source code
/**
* Copyright orazal ( http://wonderfl.net/user/orazal )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/o8Fe
*/
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.*;
import flash.net.*;
public class FlashTest extends Sprite {
private var tf:TextField;
public function FlashTest() {
tf= new TextField();
tf.width = 400;
tf.height = 200;
tf.multiline = true;
tf.wordWrap = true;
tf.border = true;
addChild(tf);
tf.text = "hello";
var pipeURL:String = "http://pipes.yahooapis.com/pipes/pipe.run?_id=749d6e33febd623b46e66b232ce632ab&_render=rss&url=";
var feedURL:String = "http://spreadsheets.google.com/feeds/list/pyG0Wix_h4onQIlKPQvgSFg/od6/public/basic?alt=rss";
var loader:URLLoader = new URLLoader();
configureListeners(loader);
var request:URLRequest = new URLRequest(pipeURL+feedURL);
try {
loader.load(request);
} catch (error:Error) {
tf.text = "Unable to load requested document.";
}
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
private function completeHandler(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
tf.text = "completeHandler: " + loader.data;
}
private function openHandler(event:Event):void {
tf.text = "openHandler: " + event;
}
private function progressHandler(event:ProgressEvent):void {
tf.text = "progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal;
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
tf.text = "securityErrorHandler: " + event;
}
private function httpStatusHandler(event:HTTPStatusEvent):void {
tf.text = "httpStatusHandler: " + event;
}
private function ioErrorHandler(event:IOErrorEvent):void {
tf.text = "ioErrorHandler: " + event;
}
}
}