Flash CS4 IDE internal cache when loading external data
When retrieving external variables from the server URLVariables my Flash get stuck on first compilation values. Whenever I update server values flash compiles the first old values. Only after i restart CS4 IDE values are updated. Is there an internal cache?
There is nothing wrong with my code, because it works fine on my mac, but not on pc.
This is purely a guess, but I suspect that Flash is making the request through the OS, and the results are being cached somewhere else. Either way, one common way of working around problems like this is to append a meaningless variable to your request - like loading data from server.com/script.php?random=209327
, where the number is of course randomized. This way the URL of each request doesn't match any of the previous requests, and you don't get a cached result.
They are stored in your system's "Temporary Internet Files" cache (ie IE's cache). I have Firefox as my default browser, and yet they're still stored in a " AppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE5 " subfolder.
Here is how I established this fact. I first re-enabled NTFS Last-Access-Time updates in Windows 7 by setting HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlFileSystemNtfsDisableLastAccessUpdate to zero and restarted the computer. I then opened Visual Studio and created a program with a FileSystemWatcher instance configured as shown in the code below:
FileSystemWatcher watcher = new FileSystemWatcher( "C:", "*.swf" );
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite;
watcher.Changed += new FileSystemEventHandler(watcher_Changed);
watcher.IncludeSubdirectories = true;
watcher.EnableRaisingEvents = true;
Next, I tested a program in Flash CS6 which loads external SWF files from a remote server. It uses the URLLoader class to get the bytes of the file first, then calls the loadBytes method of a Loader instance to load the SWF's bytes. (Using URLLoader is a workaround to bypass a local security sandbox restriction that would otherwise prevent remote code from being loaded into the same application domain and security domain of the local SWF; it's a requirement for my code base, since the remote SWF uses classes defined in the local container SWF).
The "watcher_Changed" event handler listed the files accessed or written to by the Flash IDE's player, and this is what turned up.
My container SWF "basemovie3.swf" (the main project file), was loaded from the directory:
"C:Users[your_username]AppDataLocalAdobeFlash CS6en_USConfigurationCodeModelcm-cacheSwcCachebasemovie3.swc1272273593library.swf"
The remote SWF "l003s.swf" (the problematic one being cached), was loaded from the directory:
"C:Users[your_username]AppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE5IGH0THHWl003s[1].swf"
So there you have it. The remotely loaded SWF was loaded from the Temporary Internet Files cache.
Despite appending a query string of the form "?random=randomnumber×tamp=currenttime" to the URL of the remotely loaded file "l003s.swf", the file system watcher reportd NO WRITE to any SWF files at all despite attempting to load the file multiple times with different query strings and some more attempts after updating the file on the server as well.
It seems that the best way to clear the file is to open your start menu and type "Temporary", you can click on any of the options "Change temporary Internet file settings", "Delete cookies or temporary files", or "Delete browsing history". They'll all bring you to the Temporary Internet Settings windows, where you can delete your browsing history and caches.
链接地址: http://www.djcxy.com/p/2942.html