CBC NET
/**
* Copyright Event ( http://wonderfl.net/user/Event )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/zb4N
*/
package {
import flash.net.URLRequest;
import flash.events.Event;
import flash.net.URLLoader;
import flash.text.TextField;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.display.Sprite;
public class FlashTest extends Sprite {
private static const XML_PATH:String = 'http://assets.wonderfl.net/static/assets/session5/cbcnet_feed.xml';
public function FlashTest() {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
var tf:TextField = new TextField;
tf.width = tf.height = 465;
tf.multiline = tf.wordWrap = true;
addChild(tf);
var ldr:URLLoader = new URLLoader;
ldr.addEventListener(Event.COMPLETE, function complete(e:Event):void {
ldr.removeEventListener(Event.COMPLETE, complete);
var item:XML = XML(ldr.data)..item[0];
XML.prettyPrinting = false;
tf.htmlText = <>
<a href={getTextNode("link")} target="_blank"><u>{getTextNode("title")}</u></a>
<p>
<img src={getTextNode("image")} width="75" height="75"/>
{getTextNode("description")}
</p>
</>;
function getTextNode(nodeName:String):String {
return item[nodeName].toString();
}
});
ldr.load(new URLRequest(XML_PATH));
}
}
}