Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: FLASH: XML handling in Flash 5
From: neo binedell
Date: Wed, 3 Jan 2001 08:44:19 GMT

hi aaron, yup the flash xml object does that.

you have a few options.

1) use attributes for everything (it's a lot less fuss, and rather easier to
work with)
2) load the xml as plain text, then parse it in flash to remove all unwanted
special chars, etc
3) use an asp file to request xml docs, then strip out the chars before
Response.Write() ing it back to flash.

I use 1 and 3, but 3 allows you to bring in external xml with a minimum
fuss.

so instead of

var x = new XML();

...

x.load( "http://somewhere.com/somefile.xml" );

try
//
// TheXMLFileName is set elsewhere to whatever file needs to be loaded
// eg. var TheXMLFileName = "carstats.xml"

x.load( "http://somwhere.com/xmlrequest.asp?id=" + TheXMLFileName );

the asp file then checks if the file exists, loads it, parses it and writes
it out to flash.

your root will then become a transport tag, which you can check to see if
there was an error.
(eg. file not found, file corrupt, etc)

<xmlresponse status="ok">
<carlist>
...
</carlist>
</xmlresponse>

hope that helps, or at least makes sense
layder
neo binedell

-----Original Message-----
From: owneratchinwag [dot] com [owneratchinwag [dot] com]On">mailto:owneratchinwag [dot] com]On Behalf Of Aaron
Miller
Sent: December 29, 2000 2:21 AM
To: flasheratchinwag [dot] com
Subject: FLASH: XML handling in Flash 5


Have any XML users noticed that Flash 5 seems to create nodes out of
carriage returns, so that each line break generates a new object in
the XML object? This happens even with multiple CRs in sequence.

For example, maybe someone could tell me why the following XML:

<?xml version="1.0"?>

<carlist>

<car id="0" make="ford" model="mustang" color="red">
<cname>ford_mustang_red</cname>
<doors>2</doors>
<acceleration>1.4</acceleration>
<braking>5</braking>
<corners>6</corners>
</car>

<car id="1" make="honda" model="accord" color="blue">
<cname>honda_accord_blue</cname>
<doors>2</doors>
<acceleration>1.2</acceleration>
<braking>2</braking>
<corners>2</corners>
</car>

<car id="2" make="toyota" model="tercel" color="green">
<cname>toyota_tercel_green</cname>
<doors>2</doors>
<acceleration>1.5</acceleration>
<braking>7</braking>
<corners>8</corners>
</car>

<total_cars>3</total_cars>

</carlist>

generates almost 200 child objects when imported into Flash 5?

Removing the linebreaks is an unacceptable solution, as the XML needs
to be human-readable and editable. Should I put all values in
attributes instead of creating extra nodes? And is this a bug or is
there something I don't know about well-formedness? I've read the
docs on using XML with Flash and there is nothing I've seen that even
so much as recommends a particular DocType Declaration, much less a
recommended structure...

help?

Thanks,
Aaron Miller




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
November 27-29, 2000, LONDON, National Film Theatre

Produced by United Digital Artists and lynda.com
-Sponsored by Macromedia, Adobe Systems and Apple Computer
-http://www.flashforward2000.com or UK tel. +44 (0870) 751 1526
Register before November 10 and save �200
http:// www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
November 27-29, 2000, LONDON, National Film Theatre

Produced by United Digital Artists and lynda.com
-Sponsored by Macromedia, Adobe Systems and Apple Computer
-http://www.flashforward2000.com or UK tel. +44 (0870) 751 1526
Register before November 10 and save �200
http:// www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  RE: FLASH: XML handling in Flash 5, Aaron Miller

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]