|
Posted by Onideus Mad Hatter on 03/09/07 04:26
On 8 Mar 2007 04:30:36 -0800, "SpaceGirl"
<nothespacegirlspam@subhuman.net> wrote:
>Here we go, ultra simple XML example:
<snip>
Your code is hard to read like that...why not make it like this:
:<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
:<zones>
: <zone>
: <movie title="fanzone">zone1.swf</movie>
: </zone>
: <zone>
: <movie title="two">zone1.swf</movie>
: </zone>
: <zone>
: <movie title="three">zone1.swf</movie>
: </zone>
: <zone>
: <movie title="news">zone1.swf</movie>
: </zone>
: <zone>
: <movie title="welcome">zone1.swf</movie>
: </zone>
: <zone>
: <movie title="six">zone1.swf</movie>
: </zone>
: <zone>
: <movie title="gallery">zone1.swf</movie>
: </zone>
: <zone>
: <movie title="seven">zone1.swf</movie>
: </zone>
: <zone>
: <movie title="eight">zone1.swf</movie>
: </zone>
:</zones>
:var titles_xml:XML = new XML();
:titles_xml.ignoreWhite = true;
:var titleFromXML:String;
:var clipName:String;
:var urlFromXML:String;
:
:titles_xml.onLoad = function(sucess)
:{
: if (sucess) { XML_titles(titles_xml);}
: else { trace("Couldn't load XML"); }
:}
:
:function XML_titles(xml_data)
:{
: for (i in xml_data.firstChild.childNodes)
: {
: titleFromXML = xml_data.firstChild.childNodes[i].firstChild.attributes.title;
: urlFromXML = xml_data.firstChild.childNodes[i].firstChild.firstChild.nodeValue;
: titleName = "title" + i + "_mc";
: clipName = "clip" + i + "_mc";
: titleName_alt = "title_alt" + i + "_mc";
: slider_mc.attachMovie("moviePrototype_mc", clipName, slider_mc.getNextHighestDepth());
: slider_mc[titleName_alt].title_txt.text = titleFromXML;
: slider_mc[titleName].title_txt.text = titleFromXML;
: }
:}
:
:titles_xml.load("somedata.asp");
Much easier to read, much cleaner.
>Try doing that without XML... it'd require MUCH more code. With the
>code I have above, I barely have to modify anything if the XML
>changes. It generates x number of clips, titles them etc from a single
>XML document (which in turn can be a dynamic page that populates the
>XML from a database).
....which would be absolutely fuckin retarded since um, why bother with
the XML bullshit at all? I mean, if the shit is already *IN* the
database...have it get the st00f DIRECTLY from the database.
Essentially all you've done is create a rather deficient middle man.
>With a single tweak I can change the code from
>using XML (from a URL) to use a Web Service. It would be a nightmare
>trying to do this through para passing.
....how would it be a nightmare? Just use PHP and have it directly
access a database and retrieve the data directly thus bypassing the
need for any XML. Like I said, XML is just a poor mans database.
Anything you're doing with XML I can do the same, directly, with a SQL
database. That's why XML isn't really all that important overall. It
can be handy in Flash in that you can write XML files directly without
having to go through a PHP file to write data into a database...but
the bottom line is that there are EQUIVALENT solutions that can
achieve the same ends (extra code or not) and because of that, it's
not of "life or death" importance. With something like Flash...well
shit, if there was no Flash, half the gawd damn content would just be
fucking GONE because THERE IS NO equivalent. The closest you can get
is Java...and even it comes up short as far as video playback
capabilities amongst other things. The most IMPORTANT web technology
is the one that HAS NO REPLACEMENT. There's replacements for PHP,
there's replacements for XML, there's replacements for pretty much
everything...EXCEPT for Flash.
>Okay your turn... post how to do this without XML, and less code,
>that's easier to follow. Bet you can't :)1
Sure I can, take whatever code you said was taking entries from a
database to create that XML page and just modify it so that it'll send
that data directly to the Flash st00f. Your trying to imply that:
Flash -> PHP -> SQL Database -> XML -> Flash
is somehow faster than:
Flash -> PHP -> SQL Database -> Flash
It's not and your way would actually take MORE code and overall would
actually be SLOWER. *shrugs*
The only real advantage that XML has is in creating kind of disposable
databases in order to cut down on the processor consumption that comes
from accessing/searching/sorting through a SQL database. Essentially
you can have Flash just pick up the XML file and let Flash do the
accessing/searching/sorting client side rather than server side...the
DISADVANTAGE to that however is that you wouldn't be getting "real
time" data. Well, you could, but if you had it setup that way you
wouldn't NEED the XML at all, it'd just be consuming more resources.
In some situations with EXTREME server load it might make sense to
have a server side app that will create a new XML file every few
seconds, that way it's like the database is only being continuously
accessed by a single person rather than being continuously accessed by
dozens all at the same time.
Again though, if the technology was history and simply ceased to be
you could STILL achieve the same ends (slower and more resource heavy
or not) which is why it's not the MOST important.
--
Onideus Mad Hatter
mhm ¹ x ¹
http://www.backwater-productions.net
http://www.backwater-productions.net/hatter-blog
Hatter Quotes
-------------
"You're only one of the best if you're striving to become one of the
best."
"I didn't make reality, Sunshine, I just verbally bitch slapped you
with it."
"I'm not a professional, I'm an artist."
"Your Usenet blinders are my best friend."
"Usenet Filters - Learn to shut yourself the fuck up!"
"Drugs killed Jesus you know...oh wait, no, that was the Jews, my
bad."
"There are clingy things in the grass...burrs 'n such...mmmm..."
"The more I learn the more I'm killing my idols."
"Is it wrong to incur and then use the hate ridden, vengeful stupidity
of complete strangers in random Usenet froups to further my art?"
"Freedom is only a concept, like race it's merely a social construct
that doesn't really exist outside of your ability to convince others
of its relevancy."
"Next time slow up a lil, then maybe you won't jump the gun and start
creamin yer panties before it's time to pop the champagne proper."
"Reality is directly proportionate to how creative you are."
"People are pretty fucking high on themselves if they think that
they're just born with a soul. *snicker*...yeah, like they're just
givin em out for free."
"Quible, quible said the Hare. Quite a lot of quibling...everywhere.
So the Hare took a long stare and decided at best, to leave the rest,
to their merry little mess."
"There's a difference between 'bad' and 'so earth shatteringly
horrible it makes the angels scream in terror as they violently rip
their heads off, their blood spraying into the faces of a thousand
sweet innocent horrified children, who will forever have the terrible
images burned into their tiny little minds'."
"How sad that you're such a poor judge of style that you can't even
properly gauge the artistic worth of your own efforts."
"Those who record history are those who control history."
"I am the living embodiment of hell itself in all its tormentive rage,
endless suffering, unfathomable pain and unending horror...but you
don't get sent to me...I come for you."
"Ideally in a fight I'd want a BGM-109A with a W80 250 kiloton
tactical thermonuclear fusion based war head."
"Tell me, would you describe yourself more as a process or a
function?"
"Apparently this group has got the market cornered on stupid.
Intelligence is down 137 points across the board and the forecast
indicates an increase in Webtv users."
"Is my .sig delimiter broken? Really? You're sure? Awww,
gee...that's too bad...for YOU!" `, )
[Back to original message]
|