1

I would like to know how a flash file plays/loads in the users PC. For instance, if my code is as below -

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"     codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="970" height="490" id="PRE" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="cmck_rhp_pre.swf" /><param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />    
<embed src="PRE.swf" quality="high" bgcolor="#ffffff" width="970" height="490" name="PRE" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

The PRE.swf file is about 413KB. When the user launches this page, how does the file actually play, as in, does the 413KB download to the user's PC and then starts to play or ...? Basically, I would like to know how flash files, be it swf or flv, play on a user's PC. This is in order to understand the impact before deploying.

UPDATE 1: If I open the swf file by typing in \\\PRE.swf, in the IE, the flash file plays. However, I do not see anything in the Temporary Internet Files folder.

4
  • stackoverflow ?
    – ukanth
    Commented Nov 11, 2009 at 12:53
  • 1
    I too thought so, but since it is not exactly programming related, I thought I will post it here. In fact, I have the question ready to be posted on SO as well.
    – Kanini
    Commented Nov 11, 2009 at 13:14
  • 1
    @Kanini, no, please don't multipost the same question on Stack Overflow. If people think it belongs there (which I don't), then this very question will be moved.
    – Arjan
    Commented Nov 11, 2009 at 13:42
  • Thanks Arjan, which is why I have not posted it in SO.
    – Kanini
    Commented Nov 12, 2009 at 10:07

4 Answers 4

4

In fact, Flash movies (animation) start playing as soon as the first frame is downloaded completely, while the rest of the SWF file downloads in the background. You know those "this many percent" displays that long Flash animations put up? We Flash developers call them "preloaders", and they're there to prevent the movie from starting before it's largely or completely downloaded, so you don't get stuttering and pauses if the player tries to play frames that aren't downloaded yet

The entire SWF does get downloaded, but play starts before that.

2

Just to be sure you don't confuse things: some people refer to SWF files as "Flash movies". Others use that term only for FLV (Flash video) files.

On websites, SWF is played in the Flash player, while FLV files are played by a (small, re-usable) SWF file that shows the screen and its controls (play, pause, forward, full screen, ...) and which itself is played in the Flash player.

As far as I understand, SWF file often (or always?) are downloaded all the way before playing really starts, but Flash allows for displaying a custom animated splash screen while downloading is in progress. FLV files do not need to be downloaded all the way before playing starts, and the SWF player often also allows for skipping parts of the FLV without ever downloading it (if the server supports that too).

The Flash player uses its own cache, shared (for the current user) with all browsers on your machine.

(Also note that the <object> and <embed> thing in your example are different ways to get the same thing done in different browsers.)

1

The full flash file is downloaded prior to executing. You won't see anything in your cache when viewing it like that because you're running it locally, it doesn't need to make another copy on the hard disk.

4
  • Thanks John. However, if I have viewed it once and then if I close/reopen the browser to the URL, will it be downloaded again?
    – Kanini
    Commented Nov 11, 2009 at 13:06
  • You didn't get the point Kanini - you're already running it locally there's no need for the hard disk to make another copy.
    – Charlls
    Commented Nov 11, 2009 at 13:33
  • Ah, I see where the problem is. What I wanted to mean was - if I access it via the browser, I still do not see it on the local cache. Let us for the time being, forget accessing it that way. If I access it via the HTML page, close the browser window and the reopen it and access it, will it be downloaded again? Have I atleast got it right this time around?
    – Kanini
    Commented Nov 11, 2009 at 13:43
  • If you access it via the browser using http protocol, it will be downloaded the first time if not in the cache, and accessed from the cache subsequently if it hasn't expired yet. Whether the caching is taking place is dependent on the HTTP headers your web server sends with the SWF. Commented Nov 11, 2009 at 14:03
1

It's not caching locally because it's already local! You're not using your browser to HTTP request the flash file from a remote server > therefor no need to copy to cache.

Use one of two methods to ensure SWF files are downloaded each time:

Using the 'Expires' header. The Expires header of an HTML document tells a Web browser when a cached document should expire from the cache. Using a date in the past ensures the document will always be expired.

 <!-- BEGIN INSERT --><META HTTP-EQUIV="Expires" CONTENT="Mon, 04 Dec 1999 21:29:02 GMT"><!-- END INSERT --> 

Each and every time this document is requested the browser will notice that the cached version has expired and will download the file from it's server of origin. Using the Pragma: No-Cache header. This code directs the browser to not cache the document at all.

<!-- BEGIN INSERT --><HEAD><META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"></HEAD><!-- END INSERT --> 
1
  • The <meta> tag only applies to the HTML (and should match any values set in the HTTP headers). Any embedded media can only rely on the HTTP headers. One can see those online at, for example, web-sniffer.net
    – Arjan
    Commented Nov 11, 2009 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .