Working with the Security and SecurityPanel classes
In a recent project, i was asked to build a system that would support storing cookies on a user’s local machine. This is obviously solved with SharedObjects if you’re working with the Flash Player. However, i ran into a few issues with this and found out a few interesting things.
Firstly, i wanted to detect if the user allows Flash/Flex to write to their computer. This can be solved as follows:
You can use the flush function of the SharedObject class… mySharedObject.flush(1) where 1 is the number in bytes that you require for your SharedObject. If the function returns a value of SharedObjectFlushStatus.PENDING, there is not sufficient space to store your SharedObject and a dialog appears that prompts the user to rectify this. If the function returns false, however, the user has not permitted using SharedObjects.
To call up a user’s Flash settings dialog (Camera, Display, Storage, Microphone, Privacy, Settings Manager), you would use the Security class from the flash.system package.
| Print article | This entry was posted by Danny Kopping on February 5, 2009 at 10:47 am, and is filed under ActionScript, ActionScript 3.0, Flash, Flex, Lessons. Follow any responses to this post through RSS 2.0. You can skip to the end and leave a response. Pinging is currently not allowed. |