As3 air open file




















There is a single version of Actionscript 3, named "ActionScript 3. ShaderFilter class, and its hardware support on multiple CPUs. TouchEvent class to work with multitouch devices, and other support of mobile device hardware, such as accelerometer. StageVideo class and the general framework to work with stage video playback in AS3. Worker class and the ability to delegate asynchronous work to other threads on the client.

The application's private storage directory. Each AIR application has a unique, persistent application storage directory, which is created when you first access File. This directory is unique to each application and user. This directory is a convenient location to store user-specific or application-specific data.

When you uninstall an AIR application, whether the uninstaller deletes the application storage directory and its files depends on the platform.

This means that the url string is specified starting with "app-storage:" not "file:". The applicationStorageDirectory property provides a way to reference the application storage directory that works across platforms.

If you set a File object to reference the application storage directory using the nativePath or url property, it will only work on the platform for which that path is valid.

The application's cache directory. The cacheDirectory property provides a way to reference the cache directory. Your application should use the cache directory to store files that are downloaded from a server or that can be otherwise re-generated.

Examples of files you should put in the cache directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications. If you set a File object to reference the cache directory using the nativePath or url property, it will only work on platforms for which that path is valid.

The user's desktop directory. The desktopDirectory property provides a way to reference the desktop directory that works across platforms. If you set a File object to reference the desktop directory using the nativePath or url property, it will only work on the platform for which that path is valid.

If an operating system does not support a desktop directory, a suitable directory in the file system is used instead. AIR for TV devices have no concept of a user's desktop directory. Therefore, the desktopDirectory property references the same directory location as File. The user directory is unique to the application. The user's documents directory. The documentsDirectory property provides a way to reference the documents directory that works across platforms. If you set a File object to reference the documents directory using the nativePath or url property, it will only work on the platform for which that path is valid.

If an operating system does not support a documents directory, a suitable directory in the file system is used instead. AIR for TV devices have no concept of a user's documents directory. Therefore, the documentsDirectory property references the same directory location as the File. Indicates whether the referenced file or directory was downloaded from the internet or not.

This property is only meaningful on operating systems in which files can be flagged as downloaded:. On systems that do not flag downloaded files, such as Linux, the property is not meaningful and it is set to false. Indicates whether the referenced file or directory exists.

The value is true if the File object points to an existing file or directory, false otherwise. An Icon object containing the icons defined for the file. An Icon object is an array of BitmapData objects corresponding to the various icon states. On Linux, the Icon object contains no icons.

On Android, the icon property is null. Indicates whether the reference is to a directory. The value is true if the File object points to a directory; false otherwise. Indicates whether the referenced file or directory is "hidden. Indicates whether the referenced directory is a package. The value is true if the referenced directory is a package, false otherwise.

Note that the File class does not allow creating packages directly. Indicates whether the reference is a symbolic link. The value is true if the File object is a symbolic link, false otherwise. Note that the File class does not allow creating symbolic links directly.

Symbolic links allow a file to point to another file or directory on disk. Although similar, symbolic links are not the same as aliases on Mac OS and shortcuts on Windows. An alias or a shortcut is always reported as a file rather than a directory , and reading or writing to an alias or shortcut never affects the original file or directory that it points to. On the other hand, a symbolic link generally behaves like the file or directory it points to.

It can be reported as a file or a directory, and reading or writing to a symbolic link affects the file or directory that it points to, not the symbolic link itself.

Deleting a symbolic link, however, deletes the link and not the target of the link. The line-ending character sequence used by the host operating system. On Windows, this is the carriage return character character code 0x0D hexadecimal followed by the line-feed character character code 0x0A hexadecimal. The full path in the host operating system representation. Before writing code to set the nativePath property directly, consider whether doing so may result in platform-specific code.

It is far better to use the following static properties, which represent commonly used directories, and which are valid on all platforms:. The directory that contains the file or directory referenced by this File object. If the file or directory does not exist, the parent property still returns the File object that points to the containing directory, even if that directory does not exist.

This property is identical to the return value for resolvePath ".. Indicates whether or not the runtime prevents this File object from being backed up to the cloud. If this property is set to true , it is not automatically backed up to the cloud on platforms that provide this service.

The default value of this property is false. The host operating system's path component separator character. Each pair of backslashes in a String literal represent a single backslash in the String. The space available for use at this File location, in bytes. If the File object references a directory, spaceAvailable indicates the space in the directory that files can use. If the File object references a file, spaceAvailable indicates the space into which the file could grow.

If the file location does not exist, spaceAvailable is set to 0. If the File object references a symbolic link, spaceAvailable indicates the space available at the location the symbolic link points to. Typically the space available for a directory or file is the same as the space available on the volume containing the directory or file.

However, space available can take into account quotas and per-directory limits. Adding a file or directory to a volume generally requires more space than the actual size of the file or the size of the contents of the directory. For example, the operating system may require more space to store index information. Or the disk sectors required may use additional space.

Also, available space changes dynamically. So, you cannot expect to allocate all of the reported space for file storage. The default encoding used by the host operating system. Possible values include "windows" "shift-jis" , "cn-gb" , "iso" , and others. For a complete list, see Supported Character Sets. The URL for this file path. If this is a reference to a path in the application storage directory, the URL scheme is "app-storage" ; if it is a reference to a path in the application directory, the URL scheme is "app" ; otherwise the scheme is "file".

The user's directory. The userDirectory property provides a way to reference the user directory that works across platforms. If you set the nativePath or url property of a File object directly, it will only work on the platform for which that path is valid.

If an operating system does not support a user directory, a suitable directory in the file system is used instead. The constructor function for the File class. If you pass a path argument, the File object points to the specified path, and the nativePath property and and url property are set to reflect that path.

Although you can pass a path argument to specify a file path, consider whether doing so may result in platform-specific code. You can then use the resolvePath method to get a path relative to these directories. For example, the following code sets up a File object to point to the settings.

A URL uses the file:, app:, or app-storage: scheme prefixes. However, if the valid URL prefixes are omitted, the path string is treated like a native path and no decoding takes place.

You must take this behavior into consideration when validating paths derived from potentially untrusted sources. If you simply validate the input string, URL decoding may allow an attacker to bypass your validation checks.

Always validate the final path of the instantiated File object:. The following are valid values for the path parameter using URL notation:. The app and app-storage URL schemes are useful because they can point to a valid file on all file systems. However, in the other two examples, which use the file URL scheme to point to the user's desktop directory, it would be better to pass no path argument to the File constructor and then assign File.

If you specify a native path, on Windows you can use either the backslash character or the forward slash character as the path separator in this argument; on Mac OS and Linux, use the forward slash.

The following are valid values for the path parameter using native path notation:. However, for these two examples, you should pass no path argument to the File constructor and then assign File.

Displays a directory chooser dialog box, in which the user can select a directory. When the user selects the directory, the select event is dispatched. The target property of the select event is the File object pointing to the selected directory. The directory chooser dialog is not always displayed in front of windows that are "owned" by another window windows that have a non-null owner property. To avoid window ordering issues, hide owned windows before calling this method.

Note: On Android devices, browseForDirectory is not supported. The File object dispatches a cancel event immediately. Closing the application automatically closes all files associated with FileStream objects in the application. However, it is best to register for a closed event on all FileStream objects opened asynchronously that have pending data to write, before closing the application to ensure that data is written. You can reuse the FileStream object by calling the open or the openAsync method.

This closes any file associated with the FileStream object, but the object does not dispatch the close event.

For a FileStream object opened asynchronously by using the openAsync method , even if you call the close event for a FileStream object and delete properties and variables that reference the object, the FileStream object is not garbage collected as long as there are pending operations and event handlers are registered for their completion.

In particular, an otherwise unreferenced FileStream object persists as long as any of the following are still possible:. Opens the FileStream object synchronously, pointing to the file specified by the file parameter.

If the FileStream object is already open, calling the method closes the file before opening and no further events including close are delivered for the previously opened file.

On systems that support file locking, a file opened in "write" or "update" mode FileMode. Once you are done performing operations on the file, call the close method of the FileStream object. Some operating systems limit the number of concurrently open files. Parameters file : File — The File object specifying the file to open. Opens the FileStream object asynchronously, pointing to the file specified by the file parameter.

If the fileMode parameter is set to FileMode. UPDATE , AIR reads data into the input buffer as soon as the file is opened, and progress and open events are dispatched as the data is read to the input buffer. Reads a Boolean value from the file stream, byte stream, or byte array. A single byte is read and true is returned if the byte is nonzero, false otherwise. Reads the number of data bytes, specified by the length parameter, from the file stream, byte stream, or byte array.

The bytes are read into the ByteArray objected specified by the bytes parameter, starting at the position specified by offset. The default value of 0 causes all available data to be read. Reads an IEEE double-precision floating point number from the file stream, byte stream, or byte array. Reads an IEEE single-precision floating point number from the file stream, byte stream, or byte array. Reads a multibyte string of specified length from the file stream, byte stream, or byte array using the specified character set.

Parameters length : uint — The number of bytes from the byte stream to read. Possible character set strings include "shift-jis" , "cn-gb" , "iso" , and others. For a complete list, see Supported Character Sets. For example, a value for the charSet parameter, as in myTest.

Reads an object from the file stream, byte stream, or byte array, encoded in AMF serialized format. Reads a UTF-8 string from the file stream, byte stream, or byte array.

The string is assumed to be prefixed with an unsigned short indicating the length in bytes. Reads a sequence of UTF-8 bytes from the byte stream or byte array and returns a string. Parameters length : uint — The number of bytes to read. Truncates the file at the position specified by the position property of the FileStream object. Bytes from the position specified by the position property to the end of the file are deleted. The file must be open for writing. Writes a Boolean value.

A single byte is written according to the value parameter, either 1 if true or 0 if false. Parameters value : Boolean — A Boolean value determining which byte is written. If the parameter is true , 1 is written; if false , 0 is written.

Writes a byte. The low 8 bits of the parameter are used; the high 24 bits are ignored. Parameters value : int — A byte value as an integer. Writes a sequence of bytes from the specified byte array, bytes , starting at the byte specified by offset using a zero-based index with a length specified by length , into the file stream, byte stream, or byte array. If the length parameter is omitted, the default length of 0 is used and the entire buffer starting at offset is written.

If the offset parameter is also omitted, the entire buffer is written. If the offset or length parameter is out of range, they are clamped to the beginning and end of the bytes array. Parameters bytes : ByteArray — The byte array to write. Parameters value : Number — A double-precision bit floating point number. How do I zip and unzip files using as3 in Air.

I am coding in Flash Professional. I have tried several tutorials but can't get it. I am creating this for apps using Adobe Air. Improve this question. Add a comment. Active Oldest Votes. ZipEntry; import com. ZipError; import com. ZipFileReader; import com. File; import flash. ByteArray; import flash.

FileReference; import flash.



0コメント

  • 1000 / 1000