@awayjs/graphics
Version:
AwayJS graphics classes
877 lines • 106 kB
JavaScript
import { __extends } from "tslib";
export function assert(condition, message) {
if (message === void 0) { message = 'assertion failed'; }
if (condition === '') { // avoid inadvertent false positive
condition = true;
}
if (!condition) {
if (typeof console !== 'undefined' && 'assert' in console) {
console.assert(false, message);
throw new Error(message);
}
else {
//Debug.error(message.toString());
throw new Error(message);
}
}
}
//export function memCopy<T extends TypedArray>(destination: T, source: T, doffset: number = 0,
export function memCopy(destination, source, doffset, soffset, length) {
if (doffset === void 0) { doffset = 0; }
if (soffset === void 0) { soffset = 0; }
if (length === void 0) { length = 0; }
if (soffset > 0 || (length > 0 && length < source.length)) {
if (length <= 0) {
length = source.length - soffset;
}
destination.set(source.subarray(soffset, soffset + length), doffset);
}
else {
destination.set(source, doffset);
}
}
/**
* Faster release version of bounds.
*/
var Bounds = /** @class */ (function () {
function Bounds(xMin, yMin, xMax, yMax) {
this.xMin = xMin | 0;
this.yMin = yMin | 0;
this.xMax = xMax | 0;
this.yMax = yMax | 0;
}
//static FromUntyped(source:UntypedBounds):Bounds {
Bounds.FromUntyped = function (source) {
return new Bounds(source.xMin, source.yMin, source.xMax, source.yMax);
};
//static FromRectangle(source:ASRectangle):Bounds {
Bounds.FromRectangle = function (source) {
return new Bounds(source.x * 20 | 0, source.y * 20 | 0, (source.x + source.width) * 20 | 0, (source.y + source.height) * 20 | 0);
};
Bounds.prototype.setElements = function (xMin, yMin, xMax, yMax) {
this.xMin = xMin;
this.yMin = yMin;
this.xMax = xMax;
this.yMax = yMax;
};
Bounds.prototype.copyFrom = function (source) {
this.setElements(source.xMin, source.yMin, source.xMax, source.yMax);
};
Bounds.prototype.contains = function (x, y) {
return x < this.xMin !== x < this.xMax &&
y < this.yMin !== y < this.yMax;
};
Bounds.prototype.unionInPlace = function (other) {
if (other.isEmpty()) {
return;
}
this.extendByPoint(other.xMin, other.yMin);
this.extendByPoint(other.xMax, other.yMax);
};
Bounds.prototype.extendByPoint = function (x, y) {
this.extendByX(x);
this.extendByY(y);
};
Bounds.prototype.extendByX = function (x) {
// Exclude default values.
if (this.xMin === 0x8000000) {
this.xMin = this.xMax = x;
return;
}
this.xMin = Math.min(this.xMin, x);
this.xMax = Math.max(this.xMax, x);
};
Bounds.prototype.extendByY = function (y) {
// Exclude default values.
if (this.yMin === 0x8000000) {
this.yMin = this.yMax = y;
return;
}
this.yMin = Math.min(this.yMin, y);
this.yMax = Math.max(this.yMax, y);
};
Bounds.prototype.intersects = function (toIntersect) {
return this.contains(toIntersect.xMin, toIntersect.yMin) ||
this.contains(toIntersect.xMax, toIntersect.yMax);
};
Bounds.prototype.isEmpty = function () {
return this.xMax <= this.xMin || this.yMax <= this.yMin;
};
Object.defineProperty(Bounds.prototype, "width", {
get: function () {
return this.xMax - this.xMin;
},
set: function (value) {
this.xMax = this.xMin + value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Bounds.prototype, "height", {
get: function () {
return this.yMax - this.yMin;
},
set: function (value) {
this.yMax = this.yMin + value;
},
enumerable: false,
configurable: true
});
Bounds.prototype.getBaseWidth = function (angle) {
var u = Math.abs(Math.cos(angle));
var v = Math.abs(Math.sin(angle));
return u * (this.xMax - this.xMin) + v * (this.yMax - this.yMin);
};
Bounds.prototype.getBaseHeight = function (angle) {
var u = Math.abs(Math.cos(angle));
var v = Math.abs(Math.sin(angle));
return v * (this.xMax - this.xMin) + u * (this.yMax - this.yMin);
};
Bounds.prototype.setEmpty = function () {
this.xMin = this.yMin = this.xMax = this.yMax = 0;
};
/**
* Set all fields to the sentinel value 0x8000000.
*
* This is what Flash uses to indicate uninitialized bounds. Important for bounds calculation
* in `Graphics` instances, which start out with empty bounds but must not just extend them
* from an 0,0 origin.
*/
Bounds.prototype.setToSentinels = function () {
this.xMin = this.yMin = this.xMax = this.yMax = 0x8000000;
};
Bounds.prototype.clone = function () {
return new Bounds(this.xMin, this.yMin, this.xMax, this.yMax);
};
Bounds.prototype.toString = function () {
return '{ ' +
'xMin: ' + this.xMin + ', ' +
'xMin: ' + this.yMin + ', ' +
'xMax: ' + this.xMax + ', ' +
'xMax: ' + this.yMax +
' }';
};
return Bounds;
}());
export { Bounds };
export var ImageType;
(function (ImageType) {
ImageType[ImageType["None"] = 0] = "None";
/**
* Premultiplied ARGB (byte-order).
*/
ImageType[ImageType["PremultipliedAlphaARGB"] = 1] = "PremultipliedAlphaARGB";
/**
* Unpremultiplied ARGB (byte-order).
*/
ImageType[ImageType["StraightAlphaARGB"] = 2] = "StraightAlphaARGB";
/**
* Unpremultiplied RGBA (byte-order), this is what putImageData expects.
*/
ImageType[ImageType["StraightAlphaRGBA"] = 3] = "StraightAlphaRGBA";
ImageType[ImageType["JPEG"] = 4] = "JPEG";
ImageType[ImageType["PNG"] = 5] = "PNG";
ImageType[ImageType["GIF"] = 6] = "GIF";
})(ImageType || (ImageType = {}));
export function clamp(value, min, max) {
return Math.max(min, Math.min(max, value));
}
export function roundToMultipleOfFour(x) {
return (x + 3) & ~0x3;
}
export function isObject(value) {
return typeof value === 'object' || typeof value === 'function';
}
export function isNullOrUndefined(value) {
return value == undefined;
}
function utf8decode_impl(str) {
var bytes = new Uint8Array(str.length * 4);
var b = 0;
for (var i = 0, j = str.length; i < j; i++) {
var code = str.charCodeAt(i);
if (code <= 0x7f) {
bytes[b++] = code;
continue;
}
if (0xD800 <= code && code <= 0xDBFF) {
var codeLow = str.charCodeAt(i + 1);
if (0xDC00 <= codeLow && codeLow <= 0xDFFF) {
// convert only when both high and low surrogates are present
code = ((code & 0x3FF) << 10) + (codeLow & 0x3FF) + 0x10000;
++i;
}
}
if ((code & 0xFFE00000) !== 0) {
bytes[b++] = 0xF8 | ((code >>> 24) & 0x03);
bytes[b++] = 0x80 | ((code >>> 18) & 0x3F);
bytes[b++] = 0x80 | ((code >>> 12) & 0x3F);
bytes[b++] = 0x80 | ((code >>> 6) & 0x3F);
bytes[b++] = 0x80 | (code & 0x3F);
}
else if ((code & 0xFFFF0000) !== 0) {
bytes[b++] = 0xF0 | ((code >>> 18) & 0x07);
bytes[b++] = 0x80 | ((code >>> 12) & 0x3F);
bytes[b++] = 0x80 | ((code >>> 6) & 0x3F);
bytes[b++] = 0x80 | (code & 0x3F);
}
else if ((code & 0xFFFFF800) !== 0) {
bytes[b++] = 0xE0 | ((code >>> 12) & 0x0F);
bytes[b++] = 0x80 | ((code >>> 6) & 0x3F);
bytes[b++] = 0x80 | (code & 0x3F);
}
else {
bytes[b++] = 0xC0 | ((code >>> 6) & 0x1F);
bytes[b++] = 0x80 | (code & 0x3F);
}
}
return bytes.subarray(0, b);
}
function utf8encode_impl(bytes) {
var j = 0, str = '';
while (j < bytes.length) {
var b1 = bytes[j++] & 0xFF;
if (b1 <= 0x7F) {
str += String.fromCharCode(b1);
}
else {
var currentPrefix = 0xC0;
var validBits = 5;
do {
var mask = (currentPrefix >> 1) | 0x80;
if ((b1 & mask) === currentPrefix)
break;
currentPrefix = (currentPrefix >> 1) | 0x80;
--validBits;
} while (validBits >= 0);
if (validBits <= 0) {
// Invalid UTF8 character -- copying as is
str += String.fromCharCode(b1);
continue;
}
var code = (b1 & ((1 << validBits) - 1));
var invalid = false;
for (var i = 5; i >= validBits; --i) {
var bi = bytes[j++];
if ((bi & 0xC0) != 0x80) {
// Invalid UTF8 character sequence
invalid = true;
break;
}
code = (code << 6) | (bi & 0x3F);
}
if (invalid) {
// Copying invalid sequence as is
for (var k = j - (7 - i); k < j; ++k) {
str += String.fromCharCode(bytes[k] & 255);
}
continue;
}
if (code >= 0x10000) {
str += String.fromCharCode((((code - 0x10000) >> 10) & 0x3FF) |
0xD800, (code & 0x3FF) | 0xDC00);
}
else {
str += String.fromCharCode(code);
}
}
}
return str;
}
var textEncoder = self.TextEncoder ? new self.TextEncoder() : null;
var textDecoder = self.TextDecoder ? new self.TextDecoder() : null;
export function utf8decode(str) {
if (!textEncoder)
return utf8decode_impl(str);
try {
return textEncoder.encode(str);
}
catch (e) {
return utf8decode_impl(str);
}
}
export function utf8encode(buffer) {
if (!textDecoder)
return utf8encode_impl(buffer);
try {
return textDecoder.decode(buffer);
}
catch (e) {
return utf8encode_impl(buffer);
}
}
/**
* Simple pool allocator for ArrayBuffers. This reduces memory usage in data structures
* that resize buffers.
*/
var ArrayBufferPool = /** @class */ (function () {
/**
* Creates a pool that manages a pool of a |maxSize| number of array buffers.
*/
function ArrayBufferPool(maxSize) {
if (maxSize === void 0) { maxSize = 32; }
this._list = [];
this._maxSize = maxSize;
}
/**
* Creates or reuses an existing array buffer that is at least the
* specified |length|.
*/
ArrayBufferPool.prototype.acquire = function (length) {
if (ArrayBufferPool._enabled) {
var list = this._list;
for (var i = 0; i < list.length; i++) {
var buffer = list[i];
if (buffer.byteLength >= length) {
list.splice(i, 1);
return buffer;
}
}
}
return new ArrayBuffer(length);
};
/**
* Releases an array buffer that is no longer needed back to the pool.
*/
ArrayBufferPool.prototype.release = function (buffer) {
if (ArrayBufferPool._enabled) {
var list = this._list;
//release || Debug.assert(ArrayUtilities.indexOf(list, buffer) < 0);
if (list.length === this._maxSize) {
list.shift();
}
list.push(buffer);
}
};
/**
* Resizes a Uint8Array to have the given length.
*/
ArrayBufferPool.prototype.ensureUint8ArrayLength = function (array, length) {
if (array.length >= length) {
return array;
}
var newLength = Math.max(array.length + length, ((array.length * 3) >> 1) + 1);
var newArray = new Uint8Array(this.acquire(newLength), 0, newLength);
newArray.set(array);
this.release(array.buffer);
return newArray;
};
/**
* Resizes a Float64Array to have the given length.
*/
ArrayBufferPool.prototype.ensureFloat64ArrayLength = function (array, length) {
if (array.length >= length) {
return array;
}
var newLength = Math.max(array.length + length, ((array.length * 3) >> 1) + 1);
var newArray = new Float64Array(this.acquire(newLength * Float64Array.BYTES_PER_ELEMENT), 0, newLength);
newArray.set(array);
this.release(array.buffer);
return newArray;
};
ArrayBufferPool._enabled = true;
return ArrayBufferPool;
}());
export { ArrayBufferPool };
/**
* Makes sure that a typed array has the requested capacity. If required, it creates a new
* instance of the array's class with a power-of-two capacity at least as large as required.
*/
//export function ensureTypedArrayCapacity<T extends TypedArray>(array: T, capacity: number): T {
export function ensureTypedArrayCapacity(array, capacity) {
if (array.length < capacity) {
var oldArray = array;
array = new array.constructor(IntegerUtilities.nearestPowerOfTwo(capacity));
array.set(oldArray, 0);
}
return array;
}
/*
interface Math {
imul(a: number, b: number): number;
/**
* Returns the number of leading zeros of a number.
* @param x A numeric expression.
*/
/*clz32(x: number): number;
}*/
export var IntegerUtilities;
(function (IntegerUtilities) {
var sharedBuffer = new ArrayBuffer(8);
IntegerUtilities.i8 = new Int8Array(sharedBuffer);
IntegerUtilities.u8 = new Uint8Array(sharedBuffer);
IntegerUtilities.i32 = new Int32Array(sharedBuffer);
IntegerUtilities.f32 = new Float32Array(sharedBuffer);
IntegerUtilities.f64 = new Float64Array(sharedBuffer);
IntegerUtilities.nativeLittleEndian = new Int8Array(new Int32Array([1]).buffer)[0] === 1;
/**
* Convert a float into 32 bits.
*/
function floatToInt32(v) {
IntegerUtilities.f32[0] = v;
return IntegerUtilities.i32[0];
}
IntegerUtilities.floatToInt32 = floatToInt32;
/**
* Convert 32 bits into a float.
*/
function int32ToFloat(i) {
IntegerUtilities.i32[0] = i;
return IntegerUtilities.f32[0];
}
IntegerUtilities.int32ToFloat = int32ToFloat;
/**
* Swap the bytes of a 16 bit number.
*/
function swap16(i) {
return ((i & 0xFF) << 8) | ((i >> 8) & 0xFF);
}
IntegerUtilities.swap16 = swap16;
/**
* Swap the bytes of a 32 bit number.
*/
function swap32(i) {
return ((i & 0xFF) << 24) | ((i & 0xFF00) << 8) | ((i >> 8) & 0xFF00) | ((i >> 24) & 0xFF);
}
IntegerUtilities.swap32 = swap32;
/**
* Converts a number to s8.u8 fixed point representation.
*/
function toS8U8(v) {
return ((v * 256) << 16) >> 16;
}
IntegerUtilities.toS8U8 = toS8U8;
/**
* Converts a number from s8.u8 fixed point representation.
*/
function fromS8U8(i) {
return i / 256;
}
IntegerUtilities.fromS8U8 = fromS8U8;
/**
* Round trips a number through s8.u8 conversion.
*/
function clampS8U8(v) {
return fromS8U8(toS8U8(v));
}
IntegerUtilities.clampS8U8 = clampS8U8;
/**
* Converts a number to signed 16 bits.
*/
function toS16(v) {
return (v << 16) >> 16;
}
IntegerUtilities.toS16 = toS16;
function bitCount(i) {
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
IntegerUtilities.bitCount = bitCount;
function ones(i) {
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return ((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
IntegerUtilities.ones = ones;
function trailingZeros(i) {
return IntegerUtilities.ones((i & -i) - 1);
}
IntegerUtilities.trailingZeros = trailingZeros;
function getFlags(i, flags) {
var str = '';
for (var i = 0; i < flags.length; i++) {
if (i & (1 << i)) {
str += flags[i] + ' ';
}
}
if (str.length === 0) {
return '';
}
return str.trim();
}
IntegerUtilities.getFlags = getFlags;
function isPowerOfTwo(x) {
return x && ((x & (x - 1)) === 0);
}
IntegerUtilities.isPowerOfTwo = isPowerOfTwo;
function roundToMultipleOfFour(x) {
return (x + 3) & ~0x3;
}
IntegerUtilities.roundToMultipleOfFour = roundToMultipleOfFour;
function nearestPowerOfTwo(x) {
x--;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
x++;
return x;
}
IntegerUtilities.nearestPowerOfTwo = nearestPowerOfTwo;
function roundToMultipleOfPowerOfTwo(i, powerOfTwo) {
var x = (1 << powerOfTwo) - 1;
return (i + x) & ~x; // Round up to multiple of power of two.
}
IntegerUtilities.roundToMultipleOfPowerOfTwo = roundToMultipleOfPowerOfTwo;
function toHEX(i) {
var i = (i < 0 ? 0xFFFFFFFF + i + 1 : i);
return '0x' + ('00000000' + i.toString(16)).substr(-8);
}
IntegerUtilities.toHEX = toHEX;
/**
* Polyfill imul.
*/
/*
if (!Math.imul) {
Math.imul = function imul(a, b) {
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
// the shift by 0 fixes the sign on the high part
// the final |0 converts the unsigned value into a signed value
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
};
}*/
/**
* Polyfill clz32.
*/
/*if (!Math.clz32) {
Math.clz32 = function clz32(i: number) {
i |= (i >> 1);
i |= (i >> 2);
i |= (i >> 4);
i |= (i >> 8);
i |= (i >> 16);
return 32 - IntegerUtilities.ones(i);
};
}*/
})(IntegerUtilities || (IntegerUtilities = {}));
var ABCBlock = /** @class */ (function () {
function ABCBlock() {
}
return ABCBlock;
}());
export { ABCBlock };
var EncryptedBlock = /** @class */ (function () {
function EncryptedBlock(data, size, bytePos, rawTagId) {
if (rawTagId === void 0) { rawTagId = 0; }
this.data = data;
this.size = size;
this.bytePos = bytePos;
this.rawTagId = rawTagId;
}
return EncryptedBlock;
}());
export { EncryptedBlock };
var ActionBlock = /** @class */ (function () {
function ActionBlock() {
}
return ActionBlock;
}());
export { ActionBlock };
var InitActionBlock = /** @class */ (function () {
function InitActionBlock() {
}
return InitActionBlock;
}());
export { InitActionBlock };
var SymbolExport = /** @class */ (function () {
function SymbolExport(symbolId, className) {
this.symbolId = symbolId;
this.className = className;
}
return SymbolExport;
}());
export { SymbolExport };
var UnparsedTag = /** @class */ (function () {
function UnparsedTag(tagCode, byteOffset, byteLength) {
this.tagCode = tagCode;
this.byteOffset = byteOffset;
this.byteLength = byteLength;
}
return UnparsedTag;
}());
export { UnparsedTag };
var DictionaryEntry = /** @class */ (function (_super) {
__extends(DictionaryEntry, _super);
function DictionaryEntry(id, tagCode, byteOffset, byteLength) {
var _this = _super.call(this, tagCode, byteOffset, byteLength) || this;
_this.id = id;
return _this;
}
return DictionaryEntry;
}(UnparsedTag));
export { DictionaryEntry };
var EagerlyParsedDictionaryEntry = /** @class */ (function (_super) {
__extends(EagerlyParsedDictionaryEntry, _super);
function EagerlyParsedDictionaryEntry(id, unparsed, type, definition) {
var _this = _super.call(this, id, unparsed.tagCode, unparsed.byteOffset, unparsed.byteLength) || this;
_this.type = type;
_this.definition = definition;
_this.ready = false;
return _this;
}
return EagerlyParsedDictionaryEntry;
}(DictionaryEntry));
export { EagerlyParsedDictionaryEntry };
/**
* Similar to |toString| but returns |null| for |null| or |undefined| instead
* of "null" or "undefined".
*/
export function axCoerceString(x) {
if (typeof x === 'string') {
return x;
}
else if (x == undefined) {
return null;
}
return x + '';
}
export var Errors = {
/**
* AVM2 Error Codes
*/
// OutOfMemoryError : {code: 1000, message: "The system is out of memory."},
NotImplementedError: { code: 1001, message: 'The method %1 is not implemented.' },
InvalidPrecisionError: { code: 1002, message: 'Number.toPrecision has a range of 1 to 21. Number.toFixed and Number.toExponential have a range of 0 to 20. Specified value is not within expected range.' },
InvalidRadixError: { code: 1003, message: 'The radix argument must be between 2 and 36; got %1.' },
InvokeOnIncompatibleObjectError: { code: 1004, message: 'Method %1 was invoked on an incompatible object.' },
ArrayIndexNotIntegerError: { code: 1005, message: 'Array index is not a positive integer (%1).' },
CallOfNonFunctionError: { code: 1006, message: '%1 is not a function.' },
ConstructOfNonFunctionError: { code: 1007, message: 'Instantiation attempted on a non-constructor.' },
// AmbiguousBindingError : {code: 1008, message: "%1 is ambiguous; Found more than one matching binding."},
ConvertNullToObjectError: { code: 1009, message: 'Cannot access a property or method of a null object reference.' },
ConvertUndefinedToObjectError: { code: 1010, message: 'A term is undefined and has no properties.' },
// IllegalOpcodeError : {code: 1011, message: "Method %1 contained illegal opcode %2 at offset %3."},
// LastInstExceedsCodeSizeError : {code: 1012, message: "The last instruction exceeded code size."},
// FindVarWithNoScopeError : {code: 1013, message: "Cannot call OP_findproperty when scopeDepth is 0."},
ClassNotFoundError: { code: 1014, message: 'Class %1 could not be found.' },
// IllegalSetDxns : {code: 1015, message: "Method %1 cannot set default xml namespace"},
DescendentsError: { code: 1016, message: 'Descendants operator (..) not supported on type %1.' },
// ScopeStackOverflowError : {code: 1017, message: "Scope stack overflow occurred."},
// ScopeStackUnderflowError : {code: 1018, message: "Scope stack underflow occurred."},
// GetScopeObjectBoundsError : {code: 1019, message: "Getscopeobject %1 is out of bounds."},
// CannotFallOffMethodError : {code: 1020, message: "Code cannot fall off the end of a method."},
// InvalidBranchTargetError : {code: 1021, message: "At least one branch target was not on a valid instruction in the method."},
// IllegalVoidError : {code: 1022, message: "Type void may only be used as a function return type."},
StackOverflowError: { code: 1023, message: 'Stack overflow occurred.' },
// StackUnderflowError : {code: 1024, message: "Stack underflow occurred."},
// InvalidRegisterError : {code: 1025, message: "An invalid register %1 was accessed."},
// SlotExceedsCountError : {code: 1026, message: "Slot %1 exceeds slotCount=%2 of %3."},
// MethodInfoExceedsCountError : {code: 1027, message: "Method_info %1 exceeds method_count=%2."},
// DispIdExceedsCountError : {code: 1028, message: "Disp_id %1 exceeds max_disp_id=%2 of %3."},
// DispIdUndefinedError : {code: 1029, message: "Disp_id %1 is undefined on %2."},
// StackDepthUnbalancedError : {code: 1030, message: "Stack depth is unbalanced. %1 != %2."},
// ScopeDepthUnbalancedError : {code: 1031, message: "Scope depth is unbalanced. %1 != %2."},
CpoolIndexRangeError: { code: 1032, message: 'Cpool index %1 is out of range %2.' },
CpoolEntryWrongTypeError: { code: 1033, message: 'Cpool entry %1 is wrong type.' },
CheckTypeFailedError: { code: 1034, message: 'Type Coercion failed: cannot convert %1 to %2.' },
// IllegalSuperCallError : {code: 1035, message: "Illegal super expression found in method %1."},
CannotAssignToMethodError: { code: 1037, message: 'Cannot assign to a method %1 on %2.' },
// RedefinedError : {code: 1038, message: "%1 is already defined."},
// CannotVerifyUntilReferencedError : {code: 1039, message: "Cannot verify method until it is referenced."},
CantUseInstanceofOnNonObjectError: { code: 1040, message: 'The right-hand side of instanceof must be a class or function.' },
IsTypeMustBeClassError: { code: 1041, message: 'The right-hand side of operator must be a class.' },
InvalidMagicError: { code: 1042, message: 'Not an ABC file. major_version=%1 minor_version=%2.' },
// InvalidCodeLengthError : {code: 1043, message: "Invalid code_length=%1."},
// InvalidMethodInfoFlagsError : {code: 1044, message: "MethodInfo-%1 unsupported flags=%2."},
UnsupportedTraitsKindError: { code: 1045, message: 'Unsupported traits kind=%1.' },
// MethodInfoOrderError : {code: 1046, message: "MethodInfo-%1 referenced before definition."},
// MissingEntryPointError : {code: 1047, message: "No entry point was found."},
PrototypeTypeError: { code: 1049, message: 'Prototype objects must be vanilla Objects.' },
ConvertToPrimitiveError: { code: 1050, message: 'Cannot convert %1 to primitive.' },
// IllegalEarlyBindingError : {code: 1051, message: "Illegal early binding access to %1."},
InvalidURIError: { code: 1052, message: 'Invalid URI passed to %1 function.' },
// IllegalOverrideError : {code: 1053, message: "Illegal override of %1 in %2."},
// IllegalExceptionHandlerError : {code: 1054, message: "Illegal range or target offsets in exception handler."},
WriteSealedError: { code: 1056, message: 'Cannot create property %1 on %2.' },
// IllegalSlotError : {code: 1057, message: "%1 can only contain methods."},
// IllegalOperandTypeError : {code: 1058, message: "Illegal operand type: %1 must be %2."},
// ClassInfoOrderError : {code: 1059, message: "ClassInfo-%1 is referenced before definition."},
// ClassInfoExceedsCountError : {code: 1060, message: "ClassInfo %1 exceeds class_count=%2."},
// NumberOutOfRangeError : {code: 1061, message: "The value %1 cannot be converted to %2 without losing precision."},
WrongArgumentCountError: { code: 1063, message: 'Argument count mismatch on %1. Expected %2, got %3.' },
// CannotCallMethodAsConstructor : {code: 1064, message: "Cannot call method %1 as constructor."},
UndefinedVarError: { code: 1065, message: 'Variable %1 is not defined.' },
// FunctionConstructorError : {code: 1066, message: "The form function('function body') is not supported."},
// IllegalNativeMethodBodyError : {code: 1067, message: "Native method %1 has illegal method body."},
// CannotMergeTypesError : {code: 1068, message: "%1 and %2 cannot be reconciled."},
ReadSealedError: { code: 1069, message: 'Property %1 not found on %2 and there is no default value.' },
// CallNotFoundError : {code: 1070, message: "Method %1 not found on %2"},
// AlreadyBoundError : {code: 1071, message: "Function %1 has already been bound to %2."},
// ZeroDispIdError : {code: 1072, message: "Disp_id 0 is illegal."},
// DuplicateDispIdError : {code: 1073, message: "Non-override method %1 replaced because of duplicate disp_id %2."},
ConstWriteError: { code: 1074, message: 'Illegal write to read-only property %1 on %2.' },
// MathNotFunctionError : {code: 1075, message: "Math is not a function."},
// MathNotConstructorError : {code: 1076, message: "Math is not a constructor."},
// WriteOnlyError : {code: 1077, message: "Illegal read of write-only property %1 on %2."},
// IllegalOpMultinameError : {code: 1078, message: "Illegal opcode/multiname combination: %1<%2>."},
// IllegalNativeMethodError : {code: 1079, message: "Native methods are not allowed in loaded code."},
// IllegalNamespaceError : {code: 1080, message: "Illegal value for namespace."},
// ReadSealedErrorNs : {code: 1081, message: "Property %1 not found on %2 and there is no default value."},
// NoDefaultNamespaceError : {code: 1082, message: "No default namespace has been set."},
XMLPrefixNotBound: { code: 1083, message: 'The prefix "%1" for element "%2" is not bound.' },
// XMLBadQName : {code: 1084, message: "Element or attribute (\"%1\") does not match QName production: QName::=(NCName':')?NCName."},
XMLUnterminatedElementTag: { code: 1085, message: 'The element type "%1" must be terminated by the matching end-tag "</%2>".' },
XMLOnlyWorksWithOneItemLists: { code: 1086, message: 'The %1 method only works on lists containing one item.' },
XMLAssignmentToIndexedXMLNotAllowed: { code: 1087, message: 'Assignment to indexed XML is not allowed.' },
XMLMarkupMustBeWellFormed: { code: 1088, message: 'The markup in the document following the root element must be well-formed.' },
XMLAssigmentOneItemLists: { code: 1089, message: 'Assignment to lists with more than one item is not supported.' },
XMLMalformedElement: { code: 1090, message: 'XML parser failure: element is malformed.' },
XMLUnterminatedCData: { code: 1091, message: 'XML parser failure: Unterminated CDATA section.' },
XMLUnterminatedXMLDecl: { code: 1092, message: 'XML parser failure: Unterminated XML declaration.' },
XMLUnterminatedDocTypeDecl: { code: 1093, message: 'XML parser failure: Unterminated DOCTYPE declaration.' },
XMLUnterminatedComment: { code: 1094, message: 'XML parser failure: Unterminated comment.' },
// XMLUnterminatedAttribute : {code: 1095, message: "XML parser failure: Unterminated attribute."},
XMLUnterminatedElement: { code: 1096, message: 'XML parser failure: Unterminated element.' },
// XMLUnterminatedProcessingInstruction : {code: 1097, message: "XML parser failure: Unterminated processing instruction."},
XMLNamespaceWithPrefixAndNoURI: { code: 1098, message: 'Illegal prefix %1 for no namespace.' },
RegExpFlagsArgumentError: { code: 1100, message: 'Cannot supply flags when constructing one RegExp from another.' },
// NoScopeError : {code: 1101, message: "Cannot verify method %1 with unknown scope."},
// IllegalDefaultValue : {code: 1102, message: "Illegal default value for type %1."},
// CannotExtendFinalClass : {code: 1103, message: "Class %1 cannot extend final base class."},
// XMLDuplicateAttribute : {code: 1104, message: "Attribute \"%1\" was already specified for element \"%2\"."},
// CorruptABCError : {code: 1107, message: "The ABC data is corrupt, attempt to read out of bounds."},
InvalidBaseClassError: { code: 1108, message: 'The OP_newclass opcode was used with the incorrect base class.' },
// DanglingFunctionError : {code: 1109, message: "Attempt to directly call unbound function %1 from method %2."},
// CannotExtendError : {code: 1110, message: "%1 cannot extend %2."},
// CannotImplementError : {code: 1111, message: "%1 cannot implement %2."},
// CoerceArgumentCountError : {code: 1112, message: "Argument count mismatch on class coercion. Expected 1, got %1."},
// InvalidNewActivationError : {code: 1113, message: "OP_newactivation used in method without NEED_ACTIVATION flag."},
// NoGlobalScopeError : {code: 1114, message: "OP_getglobalslot or OP_setglobalslot used with no global scope."},
// NotConstructorError : {code: 1115, message: "%1 is not a constructor."},
// ApplyError : {code: 1116, message: "second argument to Function.prototype.apply must be an array."},
XMLInvalidName: { code: 1117, message: 'Invalid XML name: %1.' },
XMLIllegalCyclicalLoop: { code: 1118, message: 'Illegal cyclical loop between nodes.' },
// DeleteTypeError : {code: 1119, message: "Delete operator is not supported with operand of type %1."},
// DeleteSealedError : {code: 1120, message: "Cannot delete property %1 on %2."},
// DuplicateMethodBodyError : {code: 1121, message: "Method %1 has a duplicate method body."},
// IllegalInterfaceMethodBodyError : {code: 1122, message: "Interface method %1 has illegal method body."},
FilterError: { code: 1123, message: 'Filter operator not supported on type %1.' },
// InvalidHasNextError : {code: 1124, message: "OP_hasnext2 requires object and index to be distinct registers."},
OutOfRangeError: { code: 1125, message: 'The index %1 is out of range %2.' },
VectorFixedError: { code: 1126, message: 'Cannot change the length of a fixed Vector.' },
TypeAppOfNonParamType: { code: 1127, message: 'Type application attempted on a non-parameterized type.' },
WrongTypeArgCountError: { code: 1128, message: 'Incorrect number of type parameters for %1. Expected %2, got %3.' },
JSONCyclicStructure: { code: 1129, message: 'Cyclic structure cannot be converted to JSON string.' },
JSONInvalidReplacer: { code: 1131, message: 'Replacer argument to JSON stringifier must be an array or a two parameter function.' },
JSONInvalidParseInput: { code: 1132, message: 'Invalid JSON parse input.' },
// FileOpenError : {code: 1500, message: "Error occurred opening file %1."},
// FileWriteError : {code: 1501, message: "Error occurred writing to file %1."},
// ScriptTimeoutError : {code: 1502, message: "A script has executed for longer than the default timeout period of 15 seconds."},
// ScriptTerminatedError : {code: 1503, message: "A script failed to exit after 30 seconds and was terminated."},
// EndOfFileError : {code: 1504, message: "End of file."},
// StringIndexOutOfBoundsError : {code: 1505, message: "The string index %1 is out of bounds; must be in range %2 to %3."},
InvalidRangeError: { code: 1506, message: 'The specified range is invalid.' },
NullArgumentError: { code: 1507, message: 'Argument %1 cannot be null.' },
InvalidArgumentError: { code: 1508, message: 'The value specified for argument %1 is invalid.' },
ArrayFilterNonNullObjectError: { code: 1510, message: 'When the callback argument is a method of a class, the optional this argument must be null.' },
InvalidParamError: { code: 2004, message: 'One of the parameters is invalid.' },
ParamRangeError: { code: 2006, message: 'The supplied index is out of bounds.' },
NullPointerError: { code: 2007, message: 'Parameter %1 must be non-null.' },
InvalidEnumError: { code: 2008, message: 'Parameter %1 must be one of the accepted values.' },
CantInstantiateError: { code: 2012, message: '%1 class cannot be instantiated.' },
InvalidBitmapData: { code: 2015, message: 'Invalid BitmapData.' },
EOFError: { code: 2030, message: 'End of file was encountered.', fqn: 'flash.errors.EOFError' },
CompressedDataError: { code: 2058, message: 'There was an error decompressing the data.', fqn: 'flash.errors.IOError' },
EmptyStringError: { code: 2085, message: 'Parameter %1 must be non-empty string.' },
ProxyGetPropertyError: { code: 2088, message: 'The Proxy class does not implement getProperty. It must be overridden by a subclass.' },
ProxySetPropertyError: { code: 2089, message: 'The Proxy class does not implement setProperty. It must be overridden by a subclass.' },
ProxyCallPropertyError: { code: 2090, message: 'The Proxy class does not implement callProperty. It must be overridden by a subclass.' },
ProxyHasPropertyError: { code: 2091, message: 'The Proxy class does not implement hasProperty. It must be overridden by a subclass.' },
ProxyDeletePropertyError: { code: 2092, message: 'The Proxy class does not implement deleteProperty. It must be overridden by a subclass.' },
ProxyGetDescendantsError: { code: 2093, message: 'The Proxy class does not implement getDescendants. It must be overridden by a subclass.' },
ProxyNextNameIndexError: { code: 2105, message: 'The Proxy class does not implement nextNameIndex. It must be overridden by a subclass.' },
ProxyNextNameError: { code: 2106, message: 'The Proxy class does not implement nextName. It must be overridden by a subclass.' },
ProxyNextValueError: { code: 2107, message: 'The Proxy class does not implement nextValue. It must be overridden by a subclass.' },
// InvalidArrayLengthError : {code: 2108, message: "The value %1 is not a valid Array length."},
// ReadExternalNotImplementedError : {code: 2173, message: "Unable to read object in stream. The class %1 does not implement flash.utils.IExternalizable but is aliased to an externalizable class."},
/**
* Player Error Codes
*/
// NoSecurityContextError : { code: 2000, message: "No active security context."},
TooFewArgumentsError: { code: 2001, message: 'Too few arguments were specified; got %1, %2 expected.' },
// InvalidSocketError : { code: 2002, message: "Operation attempted on invalid socket."},
// InvalidSocketPortError : { code: 2003, message: "Invalid socket port number specified."},
ParamTypeError: { code: 2005, message: 'Parameter %1 is of the incorrect type. Should be type %2.' },
// HasStyleSheetError : { code: 2009, message: "This method cannot be used on a text field with a style sheet."},
// SocketLocalFileSecurityError : { code: 2010, message: "Local-with-filesystem SWF files are not permitted to use sockets."},
SocketConnectError: { code: 2011, message: 'Socket connection failed to %1:%2.' },
// AuthoringOnlyFeatureError : { code: 2013, message: "Feature can only be used in Flash Authoring."},
// FeatureNotAvailableError : { code: 2014, message: "Feature is not available at this time."},
// InvalidBitmapDataError : { code: 2015, message: "Invalid BitmapData."},
// SystemExitSecurityError : { code: 2017, message: "Only trusted local files may cause the Flash Player to exit."},
// SystemExitUnsupportedError : { code: 2018, message: "System.exit is only available in the standalone Flash Player."},
// InvalidDepthError : { code: 2019, message: "Depth specified is invalid."},
// MovieClipSwapError : { code: 2020, message: "MovieClips objects with different parents cannot be swapped."},
// ObjectCreationError : { code: 2021, message: "Object creation failed."},
// NotDisplayObjectError : { code: 2022, message: "Class %1 must inherit from DisplayObject to link to a symbol."},
// NotSpriteError : { code: 2023, message: "Class %1 must inherit from Sprite to link to the root."},
CantAddSelfError: { code: 2024, message: 'An object cannot be added as a child of itself.' },
NotAChildError: { code: 2025, message: 'The supplied DisplayObject must be a child of the caller.' },
// NavigateURLError : { code: 2026, message: "An error occurred navigating to the URL %1."},
// MustBeNonNegativeError : { code: 2027, message: "Parameter %1 must be a non-negative number; got %2."},
// LocalSecurityError : { code: 2028, message: "Local-with-filesystem SWF file %1 cannot access Internet URL %2."},
// InvalidStreamError : { code: 2029, message: "This URLStream object does not have a stream opened."},
// SocketError : { code: 2031, message: "Socket Error."},
// StreamError : { code: 2032, message: "Stream Error."},
// KeyGenerationError : { code: 2033, message: "Key Generation Failed."},
// InvalidKeyError : { code: 2034, message: "An invalid digest was supplied."},
// URLNotFoundError : { code: 2035, message: "URL Not Found."},
// LoadNeverCompletedError : { code: 2036, message: "Load Never Completed."},
// InvalidCallError : { code: 2037, message: "Functions called in incorrect sequence, or earlier call was unsuccessful."},
// FileIOError : { code: 2038, message: "File I/O Error."},
// RemoteURLError : { code: 2039, message: "Invalid remote URL protocol. The remote URL protocol must be HTTP or HTTPS."},
// BrowseInProgressError : { code: 2041, message: "Only one file browsing session may be performed at a time."},
// DigestNotSupportedError : { code: 2042, message: "The digest property is not supported by this load operation."},
UnhandledError: { code: 2044, message: 'Unhandled %1:.' },
// FileVerificationError : { code: 2046, message: "The loaded file did not have a valid signature."},
// DisplayListSecurityError : { code: 2047, message: "Security sandbox violation: %1: %2 cannot access %3."},
// DownloadSecurityError : { code: 2048, message: "Security sandbox violation: %1 cannot load data from %2."},
// UploadSecurityError : { code: 2049, message: "Security sandbox violation: %1 cannot upload data to %2."},
// OutboundScriptingSecurityError : { code: 2051, message: "Security sandbox violation: %1 cannot evaluate scripting URLs within %2 (allowScriptAccess is %3). Attempted URL was %4."},
AllowDomainArgumentError: { code: 2052, message: 'Only String arguments are permitted for allowDomain and allowInsecureDomain.' },
// IntervalSecurityError : { code: 2053, message: "Security sandbox violation: %1 cannot clear an interval timer set by %2."},
// ExactSettingsError : { code: 2054, message: "The value of Security.exactSettings cannot be changed after it has been used."},
// PrintJobStartError : { code: 2055, message: "The print job could not be started."},
// PrintJobSendError : { code: 2056, message: "The print job could not be sent to the printer."},
// PrintJobAddPageError : { code: 2057, message: "The page could not be added to the print job."},
// ExternalCallbackSecurityError : { code: 2059, message: "Security sandbox violation: %1 cannot overwrite an ExternalInterface callback added by %2."},
// ExternalInterfaceSecurityError : { code: 2060, message: "Security sandbox violation: ExternalInterface caller %1 cannot access %2."},
// ExternalInterfaceNoCallbackError : { code: 2061, message: "No ExternalInterface callback %1 registered."},
// NoCloneMethodError : { code: 2062, message: "Children of Event must override clone() {return new MyEventClass (...);}."},
// IMEError : { code: 2063, message: "Error attempting to execute IME command."},
// FocusNotSetError : { code: 2065, message: "The focus cannot be set for this target."},
DelayRangeError: { code: 2066, message: 'The Timer delay specified is out of range.' },
ExternalInterfaceNotAvailableError: { code: 2067, message: 'The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.' },
// InvalidSoundError : { code: 2068, message: "Invalid sound."},
InvalidLoaderMethodError: { code: 2069, message: 'The Loader class does not implement this method.' },
// StageOwnerSecurityError : { code: 2070, message: "Security sandbox violation: caller %1 cannot access Stage owned by %2."},
InvalidStageMethodError: { code: 2071, message: 'The Stage class does not implement this property or method.' },
// ProductManagerDiskError : { code: 2073, message: "There was a problem saving the application to disk."},
// ProductManagerStageError : { code: 2074, message: "The stage is too small to fit the download ui."},
// ProductManagerVerifyError : { code: 2075, message: "The downloaded file is invalid."},
// FilterFailedError : { code: 2077, message: "This filter operation cannot be performed with the specified input parameters."},
TimelineObjectNameSealedError: { code: 2078, message: 'The name property of a Timeline-placed object cannot be modified.' },
// BitmapNotAssociatedWithBitsCharError : { code: 2079, message: "Classes derived from Bitmap can only be associated with defineBits characters (bitmaps)."},
AlreadyConnectedError: { code: 2082, message: 'Connect failed because the object is already connected.' },
CloseNotConnectedError: { code: 2083, message: 'Close failed because the object is not connected.' },
ArgumentSizeError: { code: 2084, message: 'The AMF encoding of the arguments cannot exceed 40K.' },
// FileReferenceProhibitedError : { code: 2086, message: "A setting in the mms.cfg file prohibits this FileReference request."},
// DownloadFileNameProhibitedError : { code: 2087, message: "The FileReference.download() file name contains prohibited characters."},
// EventDispatchRecursionError : { code: 2094, message: "Event dispatch recursion overflow."},
AsyncError: { code: 2095, message: '%1 was unable to invoke callback %2.' },
// DisallowedHTTPHeaderError : { code: 2096, message: "The HTTP request header %1 cannot be set via ActionScript."},
// FileFilterError : { code: 2097, message: "The FileFilter Array is not in the correct format."},
LoadingObjectNotSWFError: { code: 2098, message: 'The loading object is not a .swf file, you cannot request SWF properties from it.' },
LoadingObjectNotInitializedError: { code: 2099, message: 'The loading object is not sufficiently loaded to provide this information.' },
// EmptyByteArrayError : { code: 2100, message: "The ByteArray parameter in Loader.loadBytes() must have length greater than 0."},
DecodeParamError: { code: 2101, message: 'The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.' },
// NotAnXMLChildError : { code: 2102, message: "The before XMLNode parameter must be a child of the caller."},
// XMLRecursionError : { code: 2103, message: "XML recursion failure: new child would create infinite loop."},
SceneNotFoundError: { code: 2108, message: 'Scene %1 was not found.' },
FrameLabelNotFoundError: { code: 2109, message: 'Frame label %1 not found in scene %2.' },
// DisableAVM1LoadingError : { code: 2110, message: "The value of Security.disableAVM1Loading cannot be set unless the caller can acc