Perfect, thanks for all your help. Ill see what I can do to cut the
size out. If there is whitespace in the xml being sent back, could that
affect the parse time?
JesterXL wrote:
The lock up is the xml.parseXML running. The parseXML function is the bane
of all Flash developers, and although many enlightened individuals have
posted about various ways of handling it in Flash, the most trusted way is
to go straight for the source; the XML it's parsing. If that's not a
possibility, modifying the XML structure, then sure, you can parse manually
across frames, but I'd rather roll down a hill of razor blades landing in a
salt-pit.
Therefore, you can use the common XML parsing techniques to expediate the
XML parsing:
- use Flash 7 or above for XML parsing; Flash Player 6 was the big
optimizer, and 7 improved on it yet again. 8 you just get side-help in that
code overall is optimized.
- use attributes in your XML vs. nodes.
// bad
<node>
<child>value1</child>
<child>value2</child>
<node>
// good
<node att1="value1" att2="value2" />
- make sure if you are utilizing the data, you make references to childNodes
and other keyboards like attributes, etc. Those getter/setter properties
actually re-parse the XML internally each time your re-access them.
There are others, but those are best ones.
Again, the reason I mentioned to wait 1 frame is to ensure the stage updates
to actually show the preload bar before the XML/LoadVars parseing locks up
your display. In a lock, at least a progress bar is showing.
As far as lessenign the LoadVars load, well, you can parse it yoursel in
onData using the string methods, but you'll still probably run into
bottlenecks.
Attack the problem at it's source; either get the server to give you smaller
chunks of info, easier to parse, or use Remoting where possible.
----- Original Message -----
From: "Mike Boutin" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, December 01, 2005 7:40 PM
Subject: Re: [Flashcoders] preload loadvar xml return
Thanks! The problem I have seems to be that the flash player locks up
for about 1-2 seconds from the time I make the request, to the time I
get the xml data back. Is this something Ill just have to live with or
is it fixable?
JesterXL wrote:
Theoretically, yes. Both LoadVars & XML both have a getBytesLoaded &
getBytesTotal. However, in practice, neither took long enough to actually
justify the time in creating a preloader for them. I'd be lucky to even get
it to show a percentage.
Therefore, you're better of just showing a "loading" progress bar,
(ProgressBar.indeterminate = true):
- show the progress bar
- 1 frame later, load your XML
- when the XML arrives, update your progress bar to done
- 2 seconds later, kill the progress bar
People can argue that for LoadVars & XML calls to files larger than 200k,
it's work it, but to me, people who think Flash can parse such loads
without
locking the computer are the types of people who are well aware of what
they
are doing (parsing data across frames to prevent Flash locking up) and thus
already know how to create progress bars.
The common use case is not them, however, most are in the less than 100k
range.
----- Original Message -----
From: "Mike Boutin" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, December 01, 2005 7:16 PM
Subject: [Flashcoders] preload loadvar xml return
I am doing a loadVars call to a php file, that then returns a bunch of xml.
Is it possible to show a preloader for this load?
var catalog_xml:XML = new XML();
catalog_xml.ignoreWhite = true;
catalog_xml.onLoad = function(success:Boolean) {
if (success) {
} else {
}
sendAndLoad("catalog.php", catalog_xml);
Thanks
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders