Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / August 2008



Tip: Looking for answers? Try searching our database.

Replace XML is not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
indiramm - 05 Aug 2008 18:06 GMT
Hi,
I'm trying to load some content into flash from an XML rss feed.
I took the original code from gotoandlearn, and all I added was some buttons
to make this content change.
that is, when I click on a button, the xml has to be replaced for another one.
It works except that instead of replacing the content, it ADDs to the XML
list, everytime I click on the buttons.
I tried removing children but it doesn't work, cause it leaves no place to put
the new content.
HAve to say I'm kinda lost :)
thanks a lot!!!

Code:

 import flash.display.Loader;
    import flash.net.URLRequestMethod;
    import flash.net.URLLoader;

    import flash.display.LoaderInfo;

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);

lb.addEventListener(Event.CHANGE, itemChange);

function itemChange(e:Event):void
{
    ta.text = lb.selectedItem.data;
}

var xml:XML;
var arr:Array = new Array();
var il:XMLList;

function onLoaded(e:Event):void
{
   
    xml = new XML(e.target.data);
    il = xml.channel.item;
    for(var i:uint=0; i<il.length(); i++)
    {
        lb.addItem({data:il.description.text()[i],
                        label:il.title.text()[i]});
    }
}

loader.load(new URLRequest("http://localhost/indira/category/txt/?feed=rss"));

this.bt_foto.addEventListener(MouseEvent.CLICK,ClicFoto);

function ClicFoto(e:Event):void
{
xml = new XML
    //il = 0;
   
loader.load(new URLRequest("http://localhost/indira/category/foto/?feed=rss"));
//il.removeItem();
//il = xml.channel.item;
//delete(xml);

trace(lb.numChildren);
}

this.bt_web.addEventListener(MouseEvent.CLICK,onClickweb);

function onClickweb(e:Event):void
{
    trace(loader.data);

loader.load(new
URLRequest("http://localhost/indira/category/netweb/?feed=rss"));
}
indiramm - 06 Aug 2008 17:19 GMT
Finally, it was pretty easy, at least now that it works:

I just had to remove all:

lb.removeAll();
:)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.