All pastes #345851 Raw Edit

Someone

public cpp v1 · immutable
·published 2007-02-08 21:53 UTC
rendered paste body
_root.stop();var htmlFeed = _root.rssFeed;  // RSS Feed. This way is necessary for Myspace's <embed>var rssFeed = new XML();rssFeed.ignoreWhite = true;rssFeed.load(htmlFeed); // load XMLrssFeed.onLoad = function(success:Boolean) {	if(success) {		parseFeed(rssFeed);	} else {		loadStatus = "funzt";	}};function parseFeed(xmlDocument) { 	// populate the text boxes.	feedHeadline = "Loading...";	feedHeadline = getRSSTitle(xmlDocument);	feedHeadlinezwei = getRSSTitlezwei(xmlDocument);	feedBody_pre = getRSSContent(xmlDocument);	feedBodyzwei_pre = getRSSContentzwei(xmlDocument);	trace(feedBody_pre);	feedBody = feedBody_pre.reduce(600, "...");	trace(feedBody);		trace(feedBodyzwei_pre);	feedBodyzwei = feedBodyzwei_pre.reduce(600, "...");	trace(feedBodyzwei);	_root.play();	loadStatus = "";	}function getElementsByTagName(xmlDocument, tagName, existingNodeArray) {	// An ActionScript implementation of 	// getElementsByTagName. I'm a JavaScript guy, if this isn't obvious	// by this code.		var nodeArray;		if(existingNodeArray == null) { 		nodeArray = new Array();	} else {		nodeArray = existingNodeArray;	}		if(xmlDocument.hasChildNodes()) { 		// document has child nodes, parse away		for(var i=0; i < xmlDocument.childNodes.length; i++) {			if( (xmlDocument.childNodes[i].nodeType == 1) &&				(xmlDocument.childNodes[i].nodeName == tagname) ) {								nodeArray.push(xmlDocument.childNodes[i]);			}					getElementsByTagName(xmlDocument.childNodes[i], tagName, nodeArray);		}	}		return nodeArray;	}function getRSSTitle(xmlDocument, rssItemNo) {		if(rssItemNo == null) {		rssItemNo = 1; // default to first (first <item> is actually the channel)	}	rssTitle = getElementsByTagName(xmlDocument, "artist", "name", null)[rssItemNo];	return rssTitle.firstChild.nodeValue;}function getRSSTitlezwei(xmlDocument, rssItemNo) {		if(rssItemNo == null) {		rssItemNo = 2; // default to first (first <item> is actually the channel)	}	rssTitle = getElementsByTagName(xmlDocument, "artist", "name", null)[rssItemNo];	return rssTitle.firstChild.nodeValue;}function getRSSContent(xmlDocument, rssItemNo) {	if(rssItemNo == null) {		rssItemNo = 1;	}	rssContent = getElementsByTagName(xmlDocument, "date", null)[rssItemNo];	return rssContent.firstChild.nodeValue;}function getRSSContentzwei(xmlDocument, rssItemNo) {	if(rssItemNo == null) {		rssItemNo = 2;	}	rssContent = getElementsByTagName(xmlDocument, "date", null)[rssItemNo];	return rssContent.firstChild.nodeValue;}// from flashguru + my code - truncate a string intelligently    String.prototype.reduce=function(l,p)    {		if (this.length <= l) {			return this;		}		        var words=this.split(" ");        var numWords=words.length;        var output=[];        var ol,cWord,w;        for(w=0; w<numwords; ++w)        {            cWord=words[w];            cwl=cWord.length;            if((ol+cwl)<=l)            {                output.push(cWord);                ol+=cwl+1;            }            else break;        }        return output.join(" ")+p;    }