| Package | flash.errors | 
| Class | public dynamic class EOFError | 
| Inheritance | EOFError  IOError  Error  Object | 
| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | AIR 1.0, Flash Player 9, Flash Lite 4 | 
More examples
Working with the debugger versions
of Flash runtimes
Comparing the Error classes
flash.error package Error classes
Comparing the Error classes
flash.error package Error classes
Related API Elements
Public Properties
| Property | Defined By | ||
|---|---|---|---|
|  | constructor : Object 
	 A reference to the class object or constructor function for a given object instance. | Object | |
|  | errorID : int [read-only] 
     Contains the reference number associated with the specific error message. | Error | |
|  | message : String 
	 Contains the message associated with the Error object. | Error | |
|  | name : String 
	  Contains the name of the Error object. | Error | |
Public Methods 
| Method | Defined By | ||
|---|---|---|---|
| 
		Creates a new EOFError object. | EOFError | ||
|  | 
	 Returns the call stack for an error at the time of the error's 
	 construction as a string. | Error | |
|  | 
	 Indicates whether an object has a specified property defined. | Object | |
|  | 
	 Indicates whether an instance of the Object class is in the prototype chain of the object specified 
	 as the parameter. | Object | |
|  | 
	 Indicates whether the specified property exists and is enumerable. | Object | |
|  | 
     Sets the availability of a dynamic property for loop operations. | Object | |
|  | 
	 Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
|  | [override] 
	
	Returns the string "Error" by default or the value contained in the Error.message property,
    if defined. | Error | |
|  | 
	 Returns the primitive value of the specified object. | Object | |
Constructor Detail
| EOFError | () | Constructor | 
Examples How to use this example 
EOFErrorExample.as
 The following example uses the 
EOFErrorExample class to show 
 the error generated if an attempt is made to read past the end of the available
 data.  This is accomplished with the following steps:
 - The constructor creates a ByteArray object byteArrand writes a Boolean value offalseinto the byte stream usingwriteBoolean().
- The position of byteArris reset to0(start of the data stream).
- A single byte is removed from the data stream using readBoolean(). The data stream now contains no data.
- Within an error handling code segment set to catch EOFError objects, readBoolean()is called a second time and the EOFError is caught and passed to atrace()statement, which outputs the error message associated with EOFError objects.
package {
    import flash.display.Sprite;
    import flash.errors.EOFError;
    import flash.utils.ByteArray;
    public class EOFErrorExample extends Sprite {        
        public function EOFErrorExample() {
            var byteArr:ByteArray = new ByteArray();
            byteArr.writeBoolean(false);
            trace(byteArr.length);        // 1
            
            byteArr.position = 0;
            try {
                trace(byteArr.readBoolean());    // false
            }
            catch(e:EOFError) {
                trace(e);
            }
            try {
                trace(byteArr.readBoolean());
            } 
            catch(e:EOFError) {
                trace(e);        // EOFError: Error #2030: End of file was encountered.
            }
        }
    }
}
Thu Dec 4 2014, 05:50 PM -08:00