Discussion:
Splitting a large swf into several smaller ones
(too old to reply)
William Gill
2013-03-29 15:32:03 UTC
Permalink
I haven't worked with flash or AS for several years, but have a need to
add flash to a client website. I want to put an animation (Flash movie)
on their home page, but the first pass produced an extremely large file.
I was able to trim it significantly by editing the images and other
assets, but to further expedite load time, I want to break it into 3 or
4 swf's that load separately, play in sequence, and then repeat.

Sounds simple enough, but every reference I see relies on browser cache,
and reloads each swf on every iteration.

I may be wrong, but this seems to go against my instincts. Beside not
wanting to depend on browser cache, won't continual reloading cause
memory leaks?

Is there a way to load each swf only once, and cache it within the
parent movieclip, possibly moving it on and off the stage as needed?

Am I wrong about possible memory leaks?

(As I said it's been a very long time, so I'm using MX 2004 and AS 2,
but I think the principle is the same.)
Jasen Betts
2013-03-30 11:31:07 UTC
Permalink
Post by William Gill
I haven't worked with flash or AS for several years, but have a need to
add flash to a client website. I want to put an animation (Flash movie)
on their home page, but the first pass produced an extremely large file.
I was able to trim it significantly by editing the images and other
assets, but to further expedite load time, I want to break it into 3 or
4 swf's that load separately, play in sequence, and then repeat.
Sounds simple enough, but every reference I see relies on browser cache,
and reloads each swf on every iteration.
I may be wrong, but this seems to go against my instincts. Beside not
wanting to depend on browser cache, won't continual reloading cause
memory leaks?
Is there a way to load each swf only once, and cache it within the
parent movieclip, possibly moving it on and off the stage as needed?
Am I wrong about possible memory leaks?
(As I said it's been a very long time, so I'm using MX 2004 and AS 2,
but I think the principle is the same.)
I've see SWFs that start working before they are fully loaded,
many only show a loading bar - but some do other stuff too.

can you do that? put the resources that are needed first at the
start of the file?
--
⚂⚃ 100% natural
William Gill
2013-03-30 16:37:16 UTC
Permalink
Post by Jasen Betts
I've see SWFs that start working before they are fully loaded,
many only show a loading bar - but some do other stuff too.
can you do that? put the resources that are needed first at the
start of the file?
Technically that's not true. The swf you are seeing is fully loaded.

That "loading bar" is called a pre-loader. It is part of the fully
loaded main, or parent swf and runs until the parent determines other
assets (i.e images or other swf's) have loaded, and can now be run. It
is done so the visitor sees something without having to wait for
everything.

Visitors are very impatient, and won't wait on a page for very long
unless they have a reason. It's the reason some pages have thumbnails
of images that link to their large original, a visitor will leave a page
that takes 10 seconds to load, but will wait much longer if they
requested ("clicked the link") the slow loading, larger version. That's
the same principle behind splitting large swf's.
Jasen Betts
2013-03-31 00:07:09 UTC
Permalink
Post by William Gill
Post by Jasen Betts
I've see SWFs that start working before they are fully loaded,
many only show a loading bar - but some do other stuff too.
can you do that? put the resources that are needed first at the
start of the file?
Technically that's not true. The swf you are seeing is fully loaded.
That "loading bar" is called a pre-loader. It is part of the fully
loaded main, or parent swf and runs until the parent determines other
assets (i.e images or other swf's) have loaded, and can now be run. It
is done so the visitor sees something without having to wait for
everything.
thses were single-file swfs, they didn't use any external resources.

more than just loading bars are possible in a preloader
I've seen a tetris game for example.

Is it possible to to access resources that lie beyond the
preloader from within it? eg: the system tells the preloader the file
is 50% loaded so the preoader knows it can use resources from the
first half of the file

is it possible to have several preloaders? and run them in series?
and share preloader resources with the main script?
Post by William Gill
Visitors are very impatient, and won't wait on a page for very long
unless they have a reason. It's the reason some pages have thumbnails
of images that link to their large original, a visitor will leave a page
that takes 10 seconds to load, but will wait much longer if they
requested ("clicked the link") the slow loading, larger version. That's
the same principle behind splitting large swf's.
--
⚂⚃ 100% natural

--- news://freenews.netfront.net/ - complaints: ***@netfront.net ---
Loading...