03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

See also<br />

class statement<br />

intrinsic statement<br />

intrinsic class className [extends superClass] [implements interfaceName [,<br />

interfaceName...] ] {<br />

//class definition here<br />

}<br />

Allows compile-time type checking of previously defined classes. Flash uses intrinsic class<br />

declarations to enable compile-time type checking of built-in classes such as Array, Object,<br />

<strong>and</strong> String. This keyword indicates to the compiler that no function implementation is<br />

required, <strong>and</strong> that no bytecode should be generated for it.<br />

The intrinsic keyword can also be used with variable <strong>and</strong> function declarations. Flash uses<br />

this keyword to enable compile-time type checking for global functions <strong>and</strong> properties.<br />

The intrinsic keyword was created specifically to enable compile-time type checking for<br />

built-in classes <strong>and</strong> objects, <strong>and</strong> global variables <strong>and</strong> functions. This keyword was not meant<br />

for general purpose use, but may be of some value to developers seeking to enable compiletime<br />

type checking with previously defined classes, especially if the classes are defined using<br />

ActionScript 1.0.<br />

This keyword is supported only when used in external script files, not in scripts written in the<br />

Actions panel.<br />

Example<br />

The following example shows how to enable compile-time file checking for a previously<br />

defined ActionScript 1.0 class. The code will generate a compile-time error because the call<br />

myCircle.setRadius() sends a String value as a parameter instead of a Number value. You<br />

can avoid the error by changing the parameter to a Number value (for example, by changing<br />

"10" to 10).<br />

// The following code must be placed in a file named Circle.as<br />

// that resides within your classpath:<br />

intrinsic class Circle {<br />

var radius:Number;<br />

function Circle(radius:Number);<br />

function getArea():Number;<br />

function getDiameter():Number;<br />

function setRadius(param_radius:Number):Number;<br />

}<br />

// This ActionScript 1.0 class definition may be placed in your FLA file.<br />

// Circle class is defined using ActionScript 1.0<br />

Statements 191

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

Saved successfully!

Ooh no, something went wrong!