Void - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

void

Availability
Flash Player 5.
Usage
void (expression)
function functionName():Void {}
Description
Usage 1: Operator; a unary operator that discards the
value. The
void
undefined values.
Usage 2: Data type; used in function definitions to indicate that a function will not return a value.
Example
Usage 1: In the following ActionScript, the
if (someUndefinedVariable == void (0)) {
trace("someUndefinedVariable is undefined");
}
The previous code can also be written in the following way:
if (someUndefinedVariable == undefined) {
trace("someUndefinedVariable is undefined");
}
Usage 2: In the following example, a function that returns a value is defined using the
type, which results in a compile-time error:
function myFunction():Void {
return "This will cause a compile-time error.";
}
/* the following function call will generate a compile-time error:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: A function with return
type Void may not return a value.
return "This will cause a compile-time error.";
*/
myFunction();
1004
Chapter 2: ActionScript Language Reference
operator is often used in comparisons using the equality (
ActionScript Language Reference
expression
operator is used to test for undefined values:
void
CHAPTER 2
value and returns an undefined
) operator to test for
==
Void
return

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents