
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
64
|
Chapter 4: Classes
The intrinsic attribute
The intrinsic attribute is used only when distributing a compiled class without also
distributing the class’s source code, such as in the case of the built-in Flash Player
classes. A class defined with the intrinsic attribute includes no method bodies or
property values; it simply specifies property and method names and datatypes for the
sake of compile-time type checking.
For example, the following code shows the intrinsic class definition for the Flash
Player’s built-in LoadVars class:
dynamic intrinsic class LoadVars {
var contentType:String;
var loaded:Boolean;
var _customHeaders:Array;
function load(url:String):Boolean;
function send(url:String,target:String,method:String):Boolean;
function sendAndLoad(url:String,target,method:String):Boolean;
function getBytesLoaded( ):Number;
function getBytesTotal( ):Number;
function decode(queryString:String):Void;
function toString( ):String;
function onLoad(success:Boolean):Void;
function onData(src:String):Void;
function addRequestHeader(header:Object, headerValue:String):Void;
}
The LoadVars class is compiled into the Flash Player itself, so its source code is not
available to the ActionScript compiler at authoring time. The compiler uses the pre-
ceding intrinsic class definition to perform type checking ...