How do you know if the browser is actually using the cached swf RSL/library for Flex projects? I would like to be able to do different things from the preloader based on whether or not the user has never downloaded the library vs. they have it already cached by their browser. Is this possible?
+1
A:
I am not aware of any standard way for doing this.
You can declare a public static const VERSION_ID:String
in the main class and change its value in each build. Now if you pass the latest version id to the preloader using html query parameter, you can read it in the preloader and then compare this version id with the loaded SWF's version id. If they don't match, you have the cached version.
You can prevent the preloader SWF from caching by appending a random number to the SWF url.
<embed src="Preloader.swf?versionID=10&<?php echo "rand=".rand(1, 10000)."\""?>
Amarghosh
2009-12-07 09:35:41
Just a note, you're better off using JS's Math.random() to add URL variables, if you can. Obviously, this is not always the case ( which is why PHP would be used here ).
Christopher W. Allen-Poole
2009-12-10 06:35:58