Replace XML is not working

Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default Replace XML is not working

    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,Cli cFoto);

    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,onCl ickweb);

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

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







    indiramm Guest

  2. Similar Questions and Discussions

    1. help with the replace(pattern, replace)
      hii i hope you can help me, i want to replace two parameters on the same replace, the idea it's print in a textArea a XML file from a webService,...
    2. Replace pages not working
      I open a file Using the replace pages function under document menu Select my document and page to replace with New page shows up in current...
    3. Macromedia Flash Player installed and working properly suddenlys stops working..
      No idea what has caused the Flash player to stop working. This is not my machine but a relatives who has asked for help over the T'giving...
    4. calling Javascript: location.replace('url') inside Flash not working..
      Hello, I'm trying to call a Javascript statement via Flash but it will not work the way it normally does when I call it in plain HTML. I'm...
    5. Search and replace (super global replace)
      I am using the 30 day trail of acrobate professional....before I buy it I have a few questions.... 1) is there a "search and replace" function...
  3. #2

    Default Re: Replace XML is not working

    Finally, it was pretty easy, at least now that it works:

    I just had to remove all:

    lb.removeAll();
    :)
    indiramm Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139