5 Replies Latest reply on Apr 24, 2006 11:00 AM by BanComicSans

    parsing a partial XML list

      Ok, so I have a news section on a site that looks to an XML file to load the news. And there are about 20 news headlines in there, and the scrollbar is getting way too tiny. So, what I would like to do is have it display 10 of the headlines and then stop, but I will have a button to open an archive window so you can see all of the headlines. I know I can make 2 sections of the xml, one for the current 10 and one for the archive, but I would like to have it just pull from the same xml section and have one of them just parse 10 headlines and one parse all of them. Here's my actionscript to call the xml file, I tried changed the var=0 to var=10, but that displays everything under the 10th, and I'd rather have it display everything b/w 1 and 10, thanks in advance.

        • 1. parsing a partial XML list
          blemmo Level 1

          use the attached function. If you specify a 'max' parameter, e.g. 10, it stops after this number of entries. If you don't pass anything for 'max', it goes through the complete xml.


          • 2. parsing a partial XML list
            BanComicSans Level 1
            Thanks for the response, you'll have to excuse me for being a bit of a noob. Should I be able to just copy and paste that code into my flash file? I'm getting an output error of "type mismatch" on the ( var strHTMLNewsText:String = parseFile(objNewsPath, 10); ) line. Not sure what I'm doing wrong here. Thanks again.
            • 3. Re: parsing a partial XML list
              blemmo Level 1
              Hm, is there an info for which variable the type mismatch is found? Maybe it's objNewsPath, it should be a XMLNode object, maybe you try to pass a XML object instead? In a test, I used the first child of a XML object (the root element) for the function, worked fine.
              You could rewrite the function to accept XML objects, but then the reading (the for loop) would look a bit different.
              • 4. Re: parsing a partial XML list
                BanComicSans Level 1
                I have an xml file with multiple sections, i.e. Intro, news, and around the office. When I'm parsing it in flash I do it with the attached code at the bottom. Maybe this will help. Oh also, I've been changing the objNewsPath variable around and instead of getting the type mismatch I'm getting undefined in the area to parse the info, so I'm thinking it's the problem.

                • 5. Re: parsing a partial XML list
                  BanComicSans Level 1
                  Oh I got it working. Thanks a lot for your help man!! or woman...