Groups | Blog | Home
all groups > flash (macromedia) > november 2003 >

flash (macromedia) : XML file too large?



Carl Fink
11/14/2003 4:11:03 PM
[quoted text, click to view]

The "a script" message is sent when Flash gets stuck on one frame for too
long. Since XML loading is asynchronous, you could have the loading on one
keyframe and the code that uses the XML on a later one, then have code on an
intermediate frame to test whether loading is complete.

For instance, if your XML.load() is on frame 1, you could make frame 2 a
keyframe, then for its Actions have something like,

if (yourXML.getBytesLoaded() < yourXML.getBytesTotal){
gotoAndPlay(1)
}

(if frame 1 doesn't have a stop()).

This would constantly shuttle Flash between frames 1 and 2 until the file is
completely loaded and parsed.

With minimal effort this could become a progress meter so the user won't think
something is broken.

You might override the XLM.onData() handler to notify you when the file is
loaded -- this would let you determine how much of the time is being spent
loading vs. parsing the XML.

You didn't specify Flash versions. The XLM parser in Flash 5 is extremely
slow.
--
Carl Fink
Carl Fink
11/14/2003 4:25:10 PM
Unfortunately, Netscape Messenger doesn't appear to have a supercede
capability.

[quoted text, click to view]

Don't do that! You'll load the XML file over and over since the loading code
is on the frame.

Put the code for testing completion in frame 3 and gotoAndPlay(2).
--
Carl Fink
michael nieuwenhuizen
11/14/2003 8:10:29 PM
hello,

i got a movie that loads an XML file (that contains a music cd collection)
of about 30k. the data has to be parsed and sorted, but flash crashes.
i get the infamous "a script in the movie is causing macromedia flash player
to runslowly ...". what can i do? when is an XML file too large? is there
any way to make flash parse faster?

mike

Kim Steinhaug
11/14/2003 11:41:33 PM
Just wanted to mention Carl that that was a nice tip about preloading the
XML file aswell. I have just started using XML data for all my tickers and
menus and it works superb. But as noted, Ive accually never taken into
consideration the fact that XML files could be slow, and infact the could be
large aswell. Hasnt been a problem, but inserting such a preloader would
surtenly ensure such problems never appears!

Thanks for the tip!

--
Kim Steinhaug
---------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---------------------------------------------------------------


[quoted text, click to view]

michael nieuwenhuizen
11/15/2003 11:35:54 AM
[quoted text, click to view]

i figured that. problem is that my movies are generally 1 frame movies
(these
days i tend to make movies that contain ONLY script, no text, no images,
no symbols, even buttons are created on the fly from one template button).
my movies usually have a main movies that executes commands depending
on the value of a variable called "action"

... else if (action == 3) {
loadXML(); // function that loads XML
action++;
} else if (action == 4) {
...

[quoted text, click to view]

does that mean it stays in the frame til the XML is loaded? or does
it load the XML independently?

[quoted text, click to view]

or an "action=3" where the XML is loaded, and an "action=4"
to test if the XML is loaded?

[quoted text, click to view]

makes sense.

[quoted text, click to view]

piece of cake. for now i only had a message sayin "downloading XML",
and that was ok if the XML loaded within about 5 seconds (after which
the message turned into "idle"). a loader might be better for larger files.

[quoted text, click to view]

ok :-)

[quoted text, click to view]

flash MX (6).

thanks foir the answer,

mike

Carl Fink
11/17/2003 9:23:48 AM
[quoted text, click to view]

I expressed it very badly. What I meant was, the script doesn't halt when you
give an XML.load() command -- it goes right on to the next line, even though
the XML is in general not loaded instantly. You can't assume the file has
been completely loaded and parsed unless you test first.
--
Carl Fink
michael nieuwenhuizen
11/26/2003 6:47:56 PM
[quoted text, click to view]

hmmm, i have all the functions defined in frame 1. one of them is
loadXML() which does just what you'd expect, and which
has a:

if (success) {
... loads of functions like sorting the XML ...
stop();
}

in it to move on when the loading has been succesful. in frame 2 i put:

loadXML();

and in frame 4 a simple

gotoAndPlay(3);

i'd expect the movie to go to frame 2, where it starts to load
the XML, then move between frame 3 & 4 while loading, and
stop (at whatever frame) when the loading is done. to test
in what frame the movie is i added a big "1", "2" etc in frames
1, 2 etc.

turns out the movie stays in frame 1, and only moves to frame
2 when the XML is loaded. sounds like the command to load
the XML does stop the movie in the frame until the XML is
loaded. the movie doesn't even exit the frame: frame 2 is
shown in the movie only when the XML is loaded (and the movie
has stopped).

[quoted text, click to view]

this doesn't work. am i overseeing something?

by the way, the problem i had does get solved this way. the XML
page which is too large to load in a 'static' movie (ie: a 1-frame move
that has all the code and a stop() in the first and only frame) does
load properly now, without the warning that the player is running
slow.

my site is at http://mikkie.net. maybe some of you can see if the
list of CD's (music --> cd's) loads properly?

mike

michael nieuwenhuizen
11/27/2003 1:44:36 PM

[quoted text, click to view]

actually, i tested again, and the problem isn;'t solved. now and then
i still get the "flash player running slow" message.

mike

AddThis Social Bookmark Button