Packageflash.filesystem
Classpublic final class StorageVolumeInfo
InheritanceStorageVolumeInfo Inheritance EventDispatcher Inheritance Object

Language version: ActionScript 3.0
Runtime version: AIR 2

The StorageVolumeInfo object dispatches a StorageVolumeChangeEvent object when a storage volume is mounted or unmounted. The StorageVolume.storageVolume static property references the singleton StorageVolumeInfo object, which dispatches the events. The StorageVolumeInfo class also defines a getStorageVolumes method for listing currently mounted storage volumes.

AIR profile support: This feature is supported on all desktop operating systems, but it is not supported on all AIR for TV devices. It is also not supported on mobile devices. You can test for support at run time using the StorageVolumeInfo.isSupported property. See AIR Profile Support for more information regarding API support across multiple profiles.

On modern Linux distributions, the StorageVolumeInfo object only dispatches storageVolumeMount and storageVolumeUnmount events for physical devices and network drives mounted at particular locations.



Public Properties
 PropertyDefined by
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  currentVolumes : Vector.<StorageVolume>
[read-only] Returns a vector of the currently known StorageVolume objects.
StorageVolumeInfo
  isSupported : Boolean
[static][read-only] The isSupported property is set to true if the StorageVolumeInfo class is supported on the current platform, otherwise it is set to false.
StorageVolumeInfo
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  storageVolumeInfo : StorageVolumeInfo
[static][read-only] The singleton instance of the StorageVolumeInfo object.
StorageVolumeInfo
Public Methods
 MethodDefined by
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Dispatches an event into the event flow.
EventDispatcher
  
Returns vector of StorageVolume objects corresponding to the currently mounted storage volumes.
StorageVolumeInfo
  
Triggers an asynchronous request to find the currently mounted storage volumes.
StorageVolumeInfo
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 EventSummaryDefined by
 Inherited [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
   Dispatched when an asynchronous request to list the current storage volumes has completed.StorageVolumeInfo
 Inherited [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
   Dispatched when a storage volume has been mounted.StorageVolumeInfo
   Dispatched when a storage volume has been unmounted.StorageVolumeInfo
Property detail
currentVolumesproperty
currentVolumes:Vector.<StorageVolume>  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 50.0

Returns a vector of the currently known StorageVolume objects. This vector is created from the most recent call to getStorageVolumes or getStorageVolumesAsync and will be null until one of these methods has completed.

Implementation
    public function get currentVolumes():Vector.<StorageVolume>
isSupportedproperty 
isSupported:Boolean  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

The isSupported property is set to true if the StorageVolumeInfo class is supported on the current platform, otherwise it is set to false.

Implementation
    public static function get isSupported():Boolean
storageVolumeInfoproperty 
storageVolumeInfo:StorageVolumeInfo  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

The singleton instance of the StorageVolumeInfo object. Register event listeners on this object for the storageVolumeMount and storageVolumeUnmount events.

Implementation
    public static function get storageVolumeInfo():StorageVolumeInfo
Method detail
getStorageVolumes()method
public function getStorageVolumes():Vector.<StorageVolume>

Language version: ActionScript 3.0
Runtime version: AIR 2

Returns vector of StorageVolume objects corresponding to the currently mounted storage volumes.

On modern Linux distributions, this method returns objects corresponding to physical devices and network drives mounted at particular locations.

Returns
Vector.<StorageVolume>

See also


Example
The following code lists the native path for the root directory of each mounted storage volume:
var volumes:Vector.<StorageVolume> = new Vector.<StorageVolume>;
volumes = StorageVolumeInfo.storageVolumeInfo.getStorageVolumes();
for (var i:int = 0; i < volumes.length; i++)
{
    trace(volumes[i].rootDirectory.nativePath);
}

getStorageVolumesAsync()method 
public function getStorageVolumesAsync():void

Language version: ActionScript 3.0
Runtime version: AIR 50.0

Triggers an asynchronous request to find the currently mounted storage volumes.

A separate thread is used to query for the storage volumes available on the device. When this has completed, an Event.COMPLETE event is dispatched and the results of the search are available via the currentVolumes property.

Event detail
completeevent 
Event object type: flash.events.Event
Event.type property = flash.events.Event.COMPLETE

Language version: ActionScript 3.0
Runtime version: AIR 50.0

Dispatched when an asynchronous request to list the current storage volumes has completed.

The Event.COMPLETE constant defines the value of the type property of a complete event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe network object that has completed loading.
storageVolumeMountevent  
Event object type: flash.events.StorageVolumeChangeEvent
StorageVolumeChangeEvent.type property = flash.events.StorageVolumeChangeEvent.STORAGE_VOLUME_MOUNT

Language version: ActionScript 3.0
Runtime version: AIR 2

Dispatched when a storage volume has been mounted.

On modern Linux distributions, the StorageVolumeInfo object only dispatches storageVolumeMount and storageVolumeUnmount events for physical devices and network drives mounted at particular locations.

The StorageVolumeChangeEvent.VOLUME_MOUNT constant defines the value of the type property of a StorageVolumeChangeEvent when a volume is mounted.

The event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe StorageVolumeChangeEvent object.
fileA File object representing the storage volume.
nameThe name of the storage volume.
targetThe StorageVolumeChangeEvent object.
type"storageVolumeMount"
storageVolumeUnmountevent  
Event object type: flash.events.StorageVolumeChangeEvent
StorageVolumeChangeEvent.type property = flash.events.StorageVolumeChangeEvent.STORAGE_VOLUME_UNMOUNT

Language version: ActionScript 3.0
Runtime version: AIR 2

Dispatched when a storage volume has been unmounted.

On modern Linux distributions, the StorageVolumeInfo object only dispatches storageVolumeMount and storageVolumeUnmount events for physical devices and network drives mounted at particular locations.