Hey guys, I just wanted to share this:
I wondered how to create arrays for categories automatically from my blog (wordpress) rss feed and it was quite easy thanks to the filter array method.
here’s the code:
private function createItems():void {
for each (var cat:XML in _items.category) {
if (_categories.length>0) {
if (_categories.filter(checkThis)==false) {
_categories.push(cat);
}
} else {
_categories.push(cat);
}
}
function checkThis(element:*, index:int, arr:Array):Boolean {
if (element.text()==cat.text()) {
return true;
} else {
return false;
}
}
trace("categories are:"+_categories);
}
_items is an XMLList created by XML…items method
don’t know if it was already posted (maybe in the AS3 tip of the day) if so i apologize