Ok, well I am struggling with the crossover to AS3 but I am trying to make a super simple AIR application and it is proving to be difficult because of the AS3.
I purchased this code and trying to modify for my needs.
//*************** XML ***************//
//on news.xml load
function onNewsXMLLoad(event:Event):void {
var newsXML:XML = new XML(event.target.data);
newsXML.ignoreWhitespace = true;
for (var i:int = 0; i<newsXML.item.length(); i++) {//videos
var tileNews:Tile = new Tile();
tileNews.y = tileNews.height*i+10*i;//10 = spacing between the news tiles
//video date+name and description+link
tileNews.nameTxt.htmlText = newsXML.item*.name.text();
tileNews.infoTxt.htmlText = newsXML.item*.txt.text()+" <font color='#FFFFFF'><a href='"+newsXML.item*.linkurl.text()+"'>"+newsXML.item*.linkname.text()+"</a></font>";
//thumbnail
var imgLoader:Loader = new Loader();
imgLoader.load(new URLRequest(newsXML.item*.thumbnail.text()));
imgLoader.x = 7//horizontal position of the thumbnail
imgLoader.y = 10//vertical position of the thumbnail
tileNews.addChild(imgLoader);
scrlCnt.addChild(tileNews);
}
}
var newsXMLLoader:URLLoader = new URLLoader();
newsXMLLoader.addEventListener(Event.COMPLETE, onNewsXMLLoad, false, 0, true);
newsXMLLoader.load(new URLRequest("sunday.xml"));//load news from news.xml
I was able to figure out enough to get a button on the stage that loads another (monday.xml) into the scroller, however, it just loads it on top of the current XML items (sunday.xml).
My question is, how do I remove the previous items? And, am I even doing this right, as far as loading another xml document on a button click?
monday.addEventListener(MouseEvent.CLICK, clickSimpleButton);
function clickSimpleButton(event:MouseEvent){
trace("Button Clicked");
var newsXMLLoader:URLLoader = new URLLoader();
newsXMLLoader.addEventListener(Event.COMPLETE, onNewsXMLLoad, false, 0, true);
newsXMLLoader.load(new URLRequest("monday.xml"));//load news from news.xml
};