MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 220

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

The following example shows a
Depending on the type of error that occurred, the
object. In this case,
myRecordSet
whose
method can throw two types of errors, RecordSetException and
sortRows()
MalformedRecord.
In the following example, the RecordSetException and MalformedRecord objects are
subclasses of the Error class. Each is defined in its own AS class file.
// In RecordSetException.as:
class RecordSetException extends Error {
var message = "Record set exception occurred.";
}
// In MalformedRecord.as:
class MalformedRecord extends Error {
var message = "Malformed record exception occurred.";
}
Within the RecordSet class's
objects is thrown, depending on the type of exception that occurred. The following example
shows how this code might look:
class RecordSet {
function sortRows() {
var returnVal:Number = randomNum();
if (returnVal == 1) {
throw new RecordSetException();
}
else if (returnVal == 2) {
throw new MalformedRecord();
}
}
function randomNum():Number {
return Math.round(Math.random() * 10) % 3;
}
}
220
ActionScript language elements
code block with multiple, typed
try
is an instance of a (hypothetical) class named RecordSet
method, one of these previously defined error
sortRows()
catch
code block throws a different type of
try
code blocks.

Advertisement

Table of Contents
loading

Table of Contents