comments (5) Views: 8,542
When you run this app, you should see something like this:
While the application is running, insert any writeable external storage device, such as a thumb drive, or external hard drive, and you should see something like this:
What allows us to snoop into the file system of the hard drive? It's the StorageVolumeChangeEvent event found in the StorageVolumeInfo class. That's shorthand for saying AIR allows us to be notified when someone plugs in a USB stick, and we can then go digging into the file system to display it's contents. Lets highlight the important parts.
These lines of code are where the magic happens. All you need to do is listen for the correct event, then when it's announced, you can act upon it. The StorageVolumeChangeEvent carries along with it all the information about the announced device that you'll need to determine the name, remaining disk space, it's system path, and even the contents of the drive itself.
If this article was interesting, or helpful, or even wrong, please consider leaving a comment, or buying something from my wishlist. It's appreciated!