13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Handling errors<br />

Class name Description Notes<br />

EOFError An EOFError exception is thrown wh<strong>en</strong> you<br />

attempt to read past the <strong>en</strong>d of the available data.<br />

IllegalOperationError An IllegalOperationError exception is thrown<br />

wh<strong>en</strong> a method is not implem<strong>en</strong>ted or the<br />

implem<strong>en</strong>tation doesn't cover the curr<strong>en</strong>t usage.<br />

IOError An IOError exception is thrown wh<strong>en</strong> some type of<br />

I/O exception occurs.<br />

MemoryError A MemoryError exception is thrown wh<strong>en</strong> a<br />

memory allocation request fails.<br />

ScriptTimeoutError A ScriptTimeoutError exception is thrown wh<strong>en</strong> a<br />

script timeout interval of 15 seconds is reached. By<br />

catching a ScriptTimeoutError exception, you can<br />

handle the script timeout more gracefully. If there<br />

is no exception handler, the uncaught exception<br />

handler displays a dialog box with an error<br />

message.<br />

StackOverflowError The StackOverflowError exception is thrown wh<strong>en</strong><br />

the stack available to the script has be<strong>en</strong><br />

exhausted.<br />

Last updated 6/6/2012<br />

For example, an EOFError is thrown wh<strong>en</strong> one of the<br />

read methods in the IDataInput interface is called and<br />

there is insuffici<strong>en</strong>t data to satisfy the read request.<br />

Examples of illegal operation error exceptions include<br />

the following:<br />

A base class, such as DisplayObjectContainer,<br />

provides more functionality than the Stage can<br />

support. For example, if you attempt to get or set a<br />

mask on the Stage (using stage.mask), the Flash<br />

runtime throws an IllegalOperationError with the<br />

message “The Stage class does not implem<strong>en</strong>t this<br />

property or method.”<br />

A subclass inherits a method it does not require and<br />

does not want to support.<br />

Certain accessibility methods are called wh<strong>en</strong> Flash<br />

Player is compiled without accessibility support.<br />

Authoring-only features are called from a run-time<br />

version of Flash Player.<br />

You attempt to set the name of an object placed on<br />

the timeline.<br />

You get this error, for example, wh<strong>en</strong> a read-write<br />

operation is attempted on a socket that is not<br />

connected or that has become disconnected.<br />

By default, ActionScript Virtual Machine 2 does not<br />

impose a limit on how much memory an ActionScript<br />

program allocates. On a desktop system, memory<br />

allocation failures are infrequ<strong>en</strong>t. You see an error<br />

thrown wh<strong>en</strong> the system is unable to allocate the<br />

memory required for an operation. So, on a desktop<br />

system, this exception is rare unless an allocation<br />

request is extremely large; for example, a request for 3<br />

billion bytes is impossible because a 32-bit Microsoft®<br />

Windows® program can access only 2 GB of address<br />

space.<br />

To prev<strong>en</strong>t a malicious developer from catching the<br />

exception and staying in an infinite loop, only the first<br />

ScriptTimeoutError exception thrown in the course of<br />

a particular script can be caught. A subsequ<strong>en</strong>t<br />

ScriptTimeoutError exception cannot be caught by<br />

your code and immediately goes to the uncaught<br />

exception handler.<br />

A StackOverflowError exception might indicate that<br />

infinite recursion has occurred.<br />

69

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!