Check FlashPlayer SharedObject setting using ActionScript / 使用AS检查FP本地存储

Categories: Flex; Tagged with: ; @ February 7th, 2012 21:45

FlashPlayer provide a cool local storage mechanism called ‘SharedObject’,  we can store some user info in user local machine. for example, douban.fm store the last channel in sharedObject.

You can check the local storage setting for current domain by right click, or check all setting from Control Panel>FlashPlayer, additionally, you can manage all settings by this: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html

Flashplayer need the user configure this setting manually, but some times we want change the setting automatically, especially for some enterprise application, like E-Learning, Banking, HIS.

Currently, I did not found any API or workaround to change the local storage automatically 🙁

I just write a small tool to check the local storage setting directly, >>Link<<
(you may download and upload this swf to your server if needed)

image
 

/**
	 * Check local storage setting.
	 */ 
	protected function checkLocalStorage(event:MouseEvent):void
	{
		var sharedObjectForTest:SharedObject = SharedObject.getLocal("sharedObjectTest", "/");
		
		sharedObjectForTest.addEventListener(NetStatusEvent.NET_STATUS, onSharedObjectEvent);
		sharedObjectForTest.data.result = "OK";
		try
		{
			var result:String = sharedObjectForTest.flush();
			if(result == SharedObjectFlushStatus.FLUSHED) {
				traceLog("OK, and currect size is: " + sharedObjectForTest.size);
			}else {
				traceLog("Failed, and the Flashplayer security setting panel is shown.");
			}
		} 
		catch(error:Error) 
		{
			traceLog("Error, and show the seeting panel manually;");
			Security.showSettings(SecurityPanel.LOCAL_STORAGE);
		}
	}

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.