PDA

Click to See Complete Forum and Search --> : Scrolling XML



webguy
05-16-2001, 08:58 AM
I have been trying for a few days now to scroll a text field that is based on a xml document. The scrolling seems to work fine when the text field is populated from a variable, but it does not work from xml. I receive no erros of any kind so I'm clueless of what is actually happening can you please help? Thanks Webguy

figital
05-16-2001, 11:59 AM
Please post more details about a problem when requesting help or information (code blocks, etc). What have you read that has been either helpful or confusing?

scott
http://www.figital.com

webguy
05-16-2001, 01:20 PM
ok.. here it is..

Code on Text field
//var text = " blah blah blah,,,,,,,,,,,,"

xml1 = new XML();
xml1.onLoad = myOnLoad;
xml1.load("lo.xml");

function myOnLoad (success) {
if (success)
{Text = xml1;}}

code on button
on (release) {set("text.scroll", text.scroll - 1);}

so basically what I want to do is load an xml file into an scrollable text field it works for the var text, but not for the xml load....

Thanks for the help

marigold
05-16-2001, 04:05 PM
cant you just parse the XML and populate a variable?

webguy
05-16-2001, 04:10 PM
Originally posted by marigold
cant you just parse the XML and populate a variable?

How can you parse it? What will be the advantage of that?

Thanks

Hythian
05-16-2001, 05:59 PM
The advantage in parsing it would be to display only the elements of the XML file you want to display and to format it so it looks all nice and pretty.

Grab the flash slashdot news reader. Believe it is on flashkit so you can take a look at how it parses the slashdot xml file and formats it to look all nice. It even has a useful working scrollbar too.

-Hythian

-----
Quit Slashdot Today! ( not my site, but I like it )
http://www.cs.washington.edu/homes/klee/misc/slashdot.html

webguy
05-16-2001, 06:55 PM
[QUOTE]Originally posted by Hythian
[B]The advantage in parsing it would be to display only the elements of the XML file you want to display and to format it so it looks all nice and pretty.

Grab the flash slashdot news reader. Believe it is on flashkit so you can take a look at how it parses the slashdot xml file and formats it to look all nice. It even has a useful working scrollbar too.

-Hythian

QUOTE]

Thanks.. I put a search on for the "flash slashdot news reader" and I could not find it. Do you know where it is. Thanks for your help.

webguy
05-17-2001, 10:15 AM
I see the parse fuction but hoe do I actually parse the xml code. The online help on the parse function is not very useful. Can anyone give me an example on parsing. ALso does the format of the xml file matters when it comes to parsing? For example an xml file file that has multiple elements as opposed to one without out any.

Thanks

Hythian
05-17-2001, 01:31 PM
http://www.figleaf.com/development/flash5/

The stand-alone slashdot news reader there is the Flash5 xml application I was talking about. A simple little piece of code where it loads an xml file, displays it on screen, and has a scrollbar for you to scroll the display with.

XML.load(url) loads a file external to the movie and parses the file for you.
XML.parseXML(source) takes a source variable or string and parses that for you.

Back to your original question of why the scrolling doesn't work with the XML object being sent to the text field is because you need to populate the text field with a string, and not an XML object. So use XML.toString() to get a string representation of the XML object, and send that to the text field.

-Hythian

webguy
05-17-2001, 03:17 PM
It worked Thanks for your help.....

Thanks...