
int() Global Function
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
553
instanceof Operator
determines whether an object is an instance of a given class
Flash 6
object instanceof classConstructor
Operands
object Any object.
classConstructor
A reference to any class’s constructor function.
Returns
The Boolean true if object is an instance of classConstructor; otherwise, it returns false.
Usage
The instanceof operator does not take parentheses (it is an operator, not a function).
Example
var now = new Date();
trace(now instanceof Date); // Displays: true
See Also
typeof; the Constructor subheading for the Date class; Chapter 12; “The instanceof Oper-
ator” in Chapter 5
int() Global Function
truncate the decimal portion of a number
Flash 4; deprecated in Flash 5 in favor of analogous Math methods
int(number)
Arguments
number A number or an expression that yields a number, typically with a fractional
(decimal) portion.
Returns
The integer portion of number.
Description
The int( ) function was used in Flash 4 to extract the integer portion of a number. It effec-
tively rounds positive numbers down and rounds negative numbers up. The int( ) function
works only for numbers in the range –2147483648 (–2
31
) to 2147483647 (2
31
–1); it
produces
undefined results for numbers outside this range. If number is a string composed of ...