A RangeError exception is thrown when a numeric value is outside the acceptable range. When working with arrays, referring to an index position of an array item that does not exist will throw a RangeError exception. Using
Number.toExponential()
,
Number.toPrecision()
, and
Number.toFixed()
methods will throw a RangeError exception in cases where the arguments are outside the acceptable range of numbers. You can extend
Number.toExponential()
,
Number.toPrecision()
, and
Number.toFixed()
to avoid throwing a RangeError.
Other situations that cause this exception to be thrown include the following:
Public Properties
Property Defined By constructor : ObjectA 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 : StringContains the message associated with the Error object.
Error name : StringContains the name of the Error object.
Errorpublic function RangeError(message:String = "")
Runtime Versions: Flash Lite 4, Flash Player 9, AIR 1.0
Creates a new RangeError object.
Parametersmessage:String
(default = "
")
— Contains the message associated with the RangeError object.
More examples
The following example shows how a
RangeError
exception can be generated and handled within a
try..catch
statement.
package { import flash.display.Sprite; public class RangeErrorExample extends Sprite { public function RangeErrorExample() { var child:Sprite = new Sprite(); try { addChildAt(child, 1); } catch(e:RangeError) { trace(e); } } } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4