clearing data in URLloader

By kevinprobasco | Jul 7, 2009

actionscript3

hello all…i am a fairly new as3 user and am working on a video player that loads an xml file into a URLloader as a playlist. I have everything working but I want to add a few buttons to change the content of the playlist. All of the data will come from the same xml document, so i don’t think i have to reload the xml. I can get the content to load when the button is pushed, but it jsut adds to the previous content instead of replacing i…any ideas on how to clear the content before adding?

here is my code (that relates to this) so far….

public class playlist_controller extends MovieClip {
private var xml_loader:URLLoader;

public function playlist_controller():void {

////load the xml file
xml_loader = new URLLoader();
xml_loader.addEventListener(Event.COMPLETE, start_video);
xml_loader.load(new URLRequest("List1.xml"));

////tilelist component
tile_list.setSize(700,1200);
tile_list.columnWidth=340;
tile_list.rowHeight=110;
tile_list.direction=ScrollBarDirection.VERTICAL;
tile_list.setStyle("cellRenderer", image_details);
tile_list.setStyle("contentPadding", 10);

}

public function start_video(event:Event):void {
var lets_load_xml:XML=new XML(xml_loader.data);
var tile_list_details:XML;
////populate the playlist
for each (tile_list_details in lets_load_xml.Recent.vidz) {

////images values (in xml) and assign each one to its own cell in the tilelist
var load_images:String;
if (tile_list_details.hasOwnProperty("@load_images")> 0) {
load_images=tile_list_details.@load_images;
}
tile_list.addItem({label:tile_list_details.attribu te("text_placement_intileList").toXMLString(), data:tile_list_details.attribute("streaming_link") .toXMLString(), source:load_images});
}

newsroomList.addEventListener(MouseEvent.CLICK, newsroomList_select);

function newsroomList_select(event:Event):void {

for each (tile_list_details in lets_load_xml.Newsroom.vidz) {

////images values (in xml) and assign each one to its own cell in the tilelist
var load_images:String;
if (tile_list_details.hasOwnProperty("@load_images")> 0) {
load_images=tile_list_details.@load_images;
}
tile_list.addItem({label:tile_list_details.attribu te("text_placement_intileList").toXMLString(), data:tile_list_details.attribute("streaming_link") .toXMLString(), source:load_images});
}

}

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0