LocalCacheLoader is a library to cache content (such as swf ,images , data file etc…) to the local file system. It is fully compatible with Loader
, URLLoader
and NetStream
, being a very light weight adjustment to the browser cache functionality. When the application tries to fetch an asset or any other file, the library first checks locally for the file.
The consequence of using the lib for caching is that the communication with the server can be drastically reduced. The lib API is very similar to the native Flash loading classes as Loader
, URLLoader
and NetStream
. The only difference is that a developer must instantiate the desired loader using the lib’s factory class. After this step, the loader will behave exactly like a native one.
Sample
// Setup cache Directory. // Can be cached in the directory that you specify here . LocalCacheSettings.WORKING_DIRECTORY = File.applicationDirectory; // Please set the following: If AIR for Android, the AIR for iOS. // LocalCacheSettings.WORKING_DIRECTORY = File.applicationStorageDirectory; // Init Factory Class. // Loader like normal will be used if you do not initialize the factory class . NetClassFactory.initialize (LocalCacheLoader, LocalCacheURLLoader, LocalCacheNetStream); / Create Class. // If true the second argument here , regardless of there without a cache that is stored in the local // I will take the file from the Web always on . _loader = NetClassFactory.createLoader (null, false); // I use normally after . _loader.contentLoaderInfo.addEventListener (Event.COMPLETE, _onComplete); _loader.load (new URLRequest ("https://www.google.co.jp/images/srpr/logo11w.png"));
RT @as3gamegears: New: LocalCacheLoader (lib to cache content loading using the local file system) http://t.co/ytcX6q5iS5 #as3 #flash #game…
RT @as3gamegears: New: LocalCacheLoader (lib to cache content loading using the local file system) http://t.co/ytcX6q5iS5 #as3 #flash #game…
Vicente Fleitas liked this on Facebook.