Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,9 @@
package flash;
/**
This type represents the Flash `*` type, which is
actually the absense of type. It can be used as a
type parameter for `flash.Vector` to represent the
native `Vector.<*>` type.
**/
@:coreType abstract AnyType from Dynamic to Dynamic {}

View File

@ -0,0 +1,390 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package flash;
@:keep private class RealBoot extends Boot {
#if swc
public function new() {
super();
}
public static function initSwc(mc) {
flash.Lib.current = mc;
new RealBoot().init();
}
#else
function new() {
super();
if (flash.Lib.current == null)
flash.Lib.current = this;
start();
}
#end
}
@:dox(hide)
@:keep
class Boot extends flash.display.MovieClip {
static var tf:flash.text.TextField;
static var lines:Array<String>;
static var lastError:flash.errors.Error;
public static var skip_constructor = false;
function start() {
#if dontWaitStage
init();
#else
var c = flash.Lib.current;
try {
untyped if (c == this && c.stage != null && c.stage.align == "")
c.stage.align = cast "TOP_LEFT";
} catch (e:Dynamic) {
// security error when loading from different domain
}
if (c.stage == null)
c.addEventListener(flash.events.Event.ADDED_TO_STAGE, doInitDelay);
else if (c.stage.stageWidth == 0 || c.stage.stageHeight == 0)
untyped __global__["flash.utils.setTimeout"](start, 1);
else
init();
#end
}
function doInitDelay(_) {
flash.Lib.current.removeEventListener(flash.events.Event.ADDED_TO_STAGE, doInitDelay);
start();
}
#if (swc && swf_protected) public #end function init() {
throw "assert";
}
static var IN_E = 0;
public static function enum_to_string(e:{tag:String, params:Array<Dynamic>}) {
if (e.params == null)
return e.tag;
var pstr = [];
if (IN_E > 15) {
pstr.push("...");
} else {
IN_E++;
for (p in e.params)
pstr.push(__string_rec(p, ""));
IN_E--;
}
return e.tag + "(" + pstr.join(",") + ")";
}
public static function __instanceof(v:Dynamic, t:Dynamic) {
try {
if (t == Dynamic)
return v != null;
return untyped __is__(v, t);
} catch (e:Dynamic) {}
return false;
}
public static function __clear_trace() {
if (tf == null)
return;
tf.parent.removeChild(tf);
tf = null;
lines = null;
}
public static function __set_trace_color(rgb) {
var tf = getTrace();
tf.textColor = rgb;
tf.filters = [];
}
public static function getTrace() {
var mc = flash.Lib.current;
if (tf == null) {
tf = new flash.text.TextField();
#if flash10_2
var color = 0xFFFFFF, glow = 0;
if (mc.stage != null) {
glow = mc.stage.color;
color = 0xFFFFFF - glow;
}
tf.textColor = color;
tf.filters = [new flash.filters.GlowFilter(glow, 1, 2, 2, 20)];
#end
var format = tf.getTextFormat();
format.font = "_sans";
tf.defaultTextFormat = format;
tf.selectable = false;
tf.width = if (mc.stage == null) 800 else mc.stage.stageWidth;
tf.autoSize = flash.text.TextFieldAutoSize.LEFT;
tf.mouseEnabled = false;
}
if (mc.stage == null)
mc.addChild(tf);
else
mc.stage.addChild(tf); // on top
return tf;
}
public static function __trace(v:Dynamic, pos:haxe.PosInfos) {
var tf = getTrace();
var pstr = if (pos == null) "(null)" else pos.fileName + ":" + pos.lineNumber;
if (lines == null)
lines = [];
var str = pstr + ": " + __string_rec(v, "");
if (pos != null && pos.customParams != null)
for (v in pos.customParams)
str += "," + __string_rec(v, "");
lines = lines.concat(str.split("\n"));
tf.text = lines.join("\n");
var stage = flash.Lib.current.stage;
if (stage == null)
return;
while (lines.length > 1 && tf.height > stage.stageHeight) {
lines.shift();
tf.text = lines.join("\n");
}
}
public static function __string_rec(v:Dynamic, str:String, maxRecursion:Int = 5) {
if (maxRecursion <= 0) {
return "<...>";
}
var cname = untyped __global__["flash.utils.getQualifiedClassName"](v);
switch (cname) {
case "Object":
var k:Array<String> = untyped __keys__(v);
var s = "{";
var first = true;
for (i in 0...k.length) {
var key = k[i];
if (key == "toString")
try
return v.toString()
catch (e:Dynamic) {}
if (first)
first = false;
else
s += ",";
s += " " + key + " : " + __string_rec(v[untyped key], str, maxRecursion - 1);
}
if (!first)
s += " ";
s += "}";
return s;
case "Array":
if (v == Array)
return "#Array";
var s = "[";
var i;
var first = true;
var a:Array<Dynamic> = v;
for (i in 0...a.length) {
if (first)
first = false;
else
s += ",";
s += __string_rec(a[i], str, maxRecursion - 1);
}
return s + "]";
default:
switch (untyped __typeof__(v)) {
case "function": return "<function>";
case "undefined": return "null";
}
}
return new String(v);
}
static public function fromCodePoint(code:Int) {
var o = new flash.utils.ByteArray();
o.endian = LITTLE_ENDIAN;
o.writeShort((code >> 10) + 0xD7C0);
o.writeShort((code & 0x3FF) + 0xDC00);
o.position = 0;
return o.readMultiByte(4, "unicode");
}
static function __unprotect__(s:String) {
return s;
}
static public function mapDynamic(d:Dynamic, f:Dynamic) {
if (Std.isOfType(d, Array)) {
return untyped d["mapHX"](f);
} else {
return untyped d["map"](f);
}
}
static public function filterDynamic(d:Dynamic, f:Dynamic) {
if (Std.isOfType(d, Array)) {
return untyped d["filterHX"](f);
} else {
return untyped d["filter"](f);
}
}
static function __init__()
untyped {
var d:Dynamic = Date;
d.now = function() {
return __new__(Date);
};
d.fromTime = function(t) {
var d:Date = __new__(Date);
d.setTime(t);
return d;
};
d.fromString = function(s:String) {
switch (s.length) {
case 8: // hh:mm:ss
var k = s.split(":");
var d:Date = __new__(Date);
d.setTime(0);
d.setUTCHours(k[0]);
d.setUTCMinutes(k[1]);
d.setUTCSeconds(k[2]);
return d;
case 10: // YYYY-MM-DD
var k = s.split("-");
return new Date(cast k[0], cast k[1] - 1, cast k[2], 0, 0, 0);
case 19: // YYYY-MM-DD hh:mm:ss
var k = s.split(" ");
var y = k[0].split("-");
var t = k[1].split(":");
return new Date(cast y[0], cast y[1] - 1, cast y[2], cast t[0], cast t[1], cast t[2]);
default:
throw "Invalid date format : " + s;
}
};
d.prototype[#if no_flash_override "toStringHX" #else "toString" #end] = function() {
var date:Date = __this__;
var m = date.getMonth() + 1;
var d = date.getDate();
var h = date.getHours();
var mi = date.getMinutes();
var s = date.getSeconds();
return date.getFullYear() + "-" + (if (m < 10) "0" + m else "" + m) + "-" + (if (d < 10) "0" + d else "" + d) + " "
+ (if (h < 10) "0" + h else "" + h) + ":" + (if (mi < 10) "0" + mi else "" + mi) + ":" + (if (s < 10) "0" + s else "" + s);
};
var aproto = Array.prototype;
aproto.copy = function() {
return __this__.slice();
};
aproto.insert = function(i, x) {
__this__.splice(i, 0, x);
};
aproto.contains = function(obj) {
return __this__.indexOf(obj) != -1;
}
aproto.remove = function(obj) {
var idx = __this__.indexOf(obj);
if (idx == -1)
return false;
#if flash19
// removeAt is only available through as3 namespace and genswf9 will only generate it for a known Array,
// so we have to type it properly (thus the typecheck). See https://github.com/HaxeFoundation/haxe/issues/8612
(__this__:Array<Dynamic>).removeAt(idx);
#else
__this__.splice(idx, 1);
#end
return true;
}
aproto.iterator = function() {
return new haxe.iterators.ArrayIterator(cast __this__);
};
aproto.keyValueIterator = function() {
return new haxe.iterators.ArrayKeyValueIterator(untyped __this__);
};
aproto.resize = function(len) {
__this__.length = len;
};
aproto.setPropertyIsEnumerable("copy", false);
aproto.setPropertyIsEnumerable("insert", false);
aproto.setPropertyIsEnumerable("contains", false);
aproto.setPropertyIsEnumerable("remove", false);
aproto.setPropertyIsEnumerable("iterator", false);
aproto.setPropertyIsEnumerable("keyValueIterator", false);
aproto.setPropertyIsEnumerable("resize", false);
#if no_flash_override
aproto.filterHX = function(f) {
var ret = [];
var i = 0;
var l = __this__.length;
while (i < l) {
if (f(__this__[i]))
ret.push(__this__[i]);
i++;
}
return ret;
};
aproto.mapHX = function(f) {
var ret = [];
var i = 0;
var l = __this__.length;
while (i < l) {
ret.push(f(__this__[i]));
i++;
}
return ret;
};
aproto.setPropertyIsEnumerable("mapHX", false);
aproto.setPropertyIsEnumerable("filterHX", false);
String.prototype.charCodeAtHX = function(i):Null<Int> {
#else
aproto["filter"] = function(f) {
var ret = [];
var i = 0;
var l = __this__.length;
while (i < l) {
if (f(__this__[i]))
ret.push(__this__[i]);
i++;
}
return ret;
};
aproto["map"] = function(f) {
var ret = [];
var i = 0;
var l = __this__.length;
while (i < l) {
ret.push(f(__this__[i]));
i++;
}
return ret;
};
aproto.setPropertyIsEnumerable("map", false);
aproto.setPropertyIsEnumerable("filter", false);
String.prototype.charCodeAt = function(i):Null<Int> {
#end
var s:String = __this__;
var x:Float = s.cca(i);
if (__global__["isNaN"](x))
return null;
return Std.int(x);
};
}
}

View File

@ -0,0 +1,103 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package flash;
/**
Platform-specific Flash Library. Provides some platform-specific
functions for the Flash target.
**/
class Lib {
public static var current:flash.display.MovieClip;
public inline static function getTimer():Int {
return untyped __global__["flash.utils.getTimer"]();
}
public static function eval(path:String):Dynamic {
var p = path.split(".");
var fields = new Array();
var o:Dynamic = null;
while (p.length > 0) {
try {
o = untyped __global__["flash.utils.getDefinitionByName"](p.join("."));
} catch (e:Dynamic) {
fields.unshift(p.pop());
}
if (o != null)
break;
}
for (f in fields) {
if (o == null)
return null;
o = untyped o[f];
}
return o;
}
public static function getURL(url:flash.net.URLRequest, ?target:String) {
var f = untyped __global__["flash.net.navigateToURL"];
if (target == null)
f(url);
else
(cast f)(url, target);
}
public static function fscommand(cmd:String, ?param:String) {
untyped __global__["flash.system.fscommand"](cmd, if (param == null) "" else param);
}
public static function trace(arg:Dynamic) {
untyped __global__["trace"](arg);
}
public static function describeType(value:Dynamic):flash.xml.XML {
return untyped __global__["flash.utils.describeType"](value);
}
public static function attach(name:String):flash.display.MovieClip {
var cl = untyped __as__(__global__["flash.utils.getDefinitionByName"](name), Class);
return untyped __new__(cl);
}
public inline static function as<T>(v:Dynamic, c:Class<T>):Null<T> {
return untyped __as__(v, c);
}
public static function redirectTraces() {
if (flash.external.ExternalInterface.available)
haxe.Log.trace = traceToConsole;
}
static function traceToConsole(v:Dynamic, ?inf:haxe.PosInfos) {
var type = if (inf != null && inf.customParams != null) inf.customParams[0] else null;
if (type != "warn" && type != "info" && type != "debug" && type != "error")
type = if (inf == null) "error" else "log";
var str = if (inf == null) "" else inf.fileName + ":" + inf.lineNumber + " : ";
try
str += Std.string(v)
catch (e:Dynamic)
str += "????";
str = str.split("\\").join("\\\\");
flash.external.ExternalInterface.call("console." + type, str);
}
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package flash;
extern class Memory {
static inline function select(b:flash.utils.ByteArray):Void {
flash.system.ApplicationDomain.currentDomain.domainMemory = b;
}
static inline function setByte(addr:Int, v:Int):Void {
untyped __vmem_set__(0, addr, v);
}
static inline function setI16(addr:Int, v:Int):Void {
untyped __vmem_set__(1, addr, v);
}
static inline function setI32(addr:Int, v:Int):Void {
untyped __vmem_set__(2, addr, v);
}
static inline function setFloat(addr:Int, v:Float):Void {
untyped __vmem_set__(3, addr, v);
}
static inline function setDouble(addr:Int, v:Float):Void {
untyped __vmem_set__(4, addr, v);
}
static inline function getByte(addr:Int):Int {
return untyped __vmem_get__(0, addr);
}
static inline function getUI16(addr:Int):Int {
return untyped __vmem_get__(1, addr);
}
static inline function getI32(addr:Int):Int {
return untyped __vmem_get__(2, addr);
}
static inline function getFloat(addr:Int):Float {
return untyped __vmem_get__(3, addr);
}
static inline function getDouble(addr:Int):Float {
return untyped __vmem_get__(4, addr);
}
static inline function signExtend1(v:Int):Int {
return untyped __vmem_sign__(0, v);
}
static inline function signExtend8(v:Int):Int {
return untyped __vmem_sign__(1, v);
}
static inline function signExtend16(v:Int):Int {
return untyped __vmem_sign__(2, v);
}
}

View File

@ -0,0 +1,418 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package flash;
import flash.xml.XML;
import flash.xml.XMLList;
extern enum XmlType {}
typedef NativeXml = Xml;
class Xml {
public static var Element(default, null):XmlType;
public static var PCData(default, null):XmlType;
public static var CData(default, null):XmlType;
public static var Comment(default, null):XmlType;
public static var DocType(default, null):XmlType;
public static var ProcessingInstruction(default, null):XmlType;
public static var Document(default, null):XmlType;
public var nodeType(default, null):XmlType;
public var nodeName(get, set):String;
public var nodeValue(get, set):String;
public var parent(get, null):Xml;
var _node:flash.xml.XML;
public static function parse(str:String):Xml {
XML.ignoreWhitespace = false;
XML.ignoreProcessingInstructions = false;
XML.ignoreComments = false;
var prefix = "<__document";
var root = null;
while (root == null) {
try {
root = new flash.xml.XML(prefix + ">" + str + "</__document>");
} catch (e:flash.errors.TypeError) {
// if we miss a namespace, let's add it !
var r = ~/"([^"]+)"/; // "
if (e.errorID == 1083 && r.match(e.message)) {
var ns = r.matched(1);
prefix += " xmlns:" + ns + '="@' + ns + '"';
} else
throw e;
}
}
return wrap(root, Xml.Document);
}
@:keep static function compare(a:Xml, b:Xml):Bool {
return a == null ? b == null : (b == null ? false : a._node == b._node);
}
private function new():Void {}
public static function createElement(name:String):Xml {
return wrap(new flash.xml.XML("<" + name + "/>"), Xml.Element);
}
public static function createPCData(data:String):Xml {
XML.ignoreWhitespace = false;
return wrap(new flash.xml.XML(data), Xml.PCData);
}
public static function createCData(data:String):Xml {
return wrap(new flash.xml.XML("<![CDATA[" + data + "]]>"), Xml.CData);
}
public static function createComment(data:String):Xml {
XML.ignoreComments = false;
return wrap(new flash.xml.XML("<!--" + data + "-->"), Xml.Comment);
}
public static function createDocType(data:String):Xml {
return wrap(new flash.xml.XML("<!DOCTYPE " + data + ">"), Xml.DocType);
}
public static function createProcessingInstruction(data:String):Xml {
XML.ignoreProcessingInstructions = false;
return wrap(new flash.xml.XML("<?" + data + "?>"), Xml.ProcessingInstruction);
}
public static function createDocument():Xml {
return wrap(new flash.xml.XML("<__document/>"), Xml.Document);
}
private static function getNodeType(node:flash.xml.XML):XmlType {
switch (node.nodeKind()) {
case "element":
return Xml.Element;
case "text":
return Xml.PCData;
case "processing-instruction":
return Xml.ProcessingInstruction;
case "comment":
return Xml.Comment;
default:
throw "unimplemented node type: " + node.nodeType;
}
}
private function get_nodeName():String {
if (nodeType != Xml.Element)
throw "bad nodeType";
var ns = _node.namespace();
return (ns.prefix == "") ? _node.localName() : ns.prefix + ":" + _node.localName();
}
private function set_nodeName(n:String):String {
if (nodeType != Xml.Element)
throw "bad nodeType";
var ns = n.split(":");
if (ns.length == 1)
_node.setLocalName(n);
else {
_node.setLocalName(ns[1]);
_node.setNamespace(_node.namespace(ns[0]));
}
return n;
}
private function get_nodeValue():String {
var nodeType = nodeType;
if (nodeType == Xml.Element || nodeType == Xml.Document)
throw "bad nodeType";
if (nodeType == Xml.Comment)
return _node.toString().substr(4, -7);
return _node.toString();
}
private function set_nodeValue(v:String):String {
var nodeType = nodeType;
var x = null;
if (nodeType == Xml.Element || nodeType == Xml.Document)
throw "bad nodeType";
else if (nodeType == Xml.PCData)
x = createPCData(v);
else if (nodeType == Xml.CData)
x = createCData(v);
else if (nodeType == Xml.Comment)
x = createComment(v);
else if (nodeType == Xml.DocType)
x = createDocType(v);
else
x = createProcessingInstruction(v);
var p = _node.parent();
if (p != null) {
p.insertChildAfter(_node, x._node);
var i = _node.childIndex();
var children = p.children();
untyped __delete__(children, Reflect.fields(children)[i]);
}
_node = x._node;
return v;
}
private function get_parent():Xml {
var p = _node.parent();
return p == null ? null : wrap(p);
}
private static function wrap(node:XML, ?type:XmlType):Xml {
var x = new Xml();
x._node = node;
x.nodeType = (type != null) ? type : getNodeType(node);
return x;
}
private function wraps(xList:XMLList):Array<Xml> {
var out = new Array<Xml>();
for (i in 0...xList.length())
out.push(wrap(xList[i]));
return out;
}
function getAttribNS(cur:XML, ns:Array<String>):XMLList {
var n = cur.namespace(ns[0]);
if (n == null) {
var parent = cur.parent();
if (parent == null) {
n = new flash.utils.Namespace(ns[0], "@" + ns[0]);
cur.addNamespace(n);
} else
return getAttribNS(parent, ns);
}
return _node.attribute(new flash.utils.QName(n, ns[1]));
}
public function get(att:String):String {
if (nodeType != Xml.Element)
throw "bad nodeType";
var ns = att.split(":");
if (ns[0] == "xmlns") {
var n = _node.namespace((ns[1] == null) ? "" : ns[1]);
return (n == null) ? null : n.uri;
}
if (ns.length == 1) {
if (!Reflect.hasField(_node, "@" + att))
return null;
return Reflect.field(_node, "@" + att);
}
var a = getAttribNS(_node, ns);
return (a.length() == 0) ? null : a.toString();
}
public function set(att:String, value:String):Void {
if (nodeType != Xml.Element)
throw "bad nodeType";
var ns = att.split(":");
if (ns[0] == "xmlns") {
var n = _node.namespace((ns[1] == null) ? "" : ns[1]);
if (n != null)
throw "Can't modify namespace";
if (ns[1] == null)
throw "Can't set default namespace";
_node.addNamespace(new flash.utils.Namespace(ns[1], value));
return;
}
if (ns.length == 1)
Reflect.setField(_node, "@" + att, value);
else {
var a = getAttribNS(_node, ns);
untyped a[0] = value;
}
}
public function remove(att:String):Void {
if (nodeType != Xml.Element)
throw "bad nodeType";
var ns = att.split(":");
if (ns.length == 1)
Reflect.deleteField(_node, "@" + att);
else
untyped __delete__(getAttribNS(_node, ns), 0);
}
public function exists(att:String):Bool {
if (nodeType != Xml.Element)
throw "bad nodeType";
var ns = att.split(":");
if (ns[0] == "xmlns")
return _node.namespace((ns[1] == null) ? "" : ns[1]) != null;
if (ns.length == 1)
return Reflect.hasField(_node, "@" + att);
return getAttribNS(_node, ns).length() > 0;
}
public function attributes():Iterator<String> {
if (nodeType != Xml.Element)
throw "bad nodeType";
var attributes:XMLList = _node.attributes();
var names = Reflect.fields(attributes);
var cur = 0;
var nss = _node.namespaceDeclarations();
return {
hasNext: function() {
return cur < names.length + nss.length;
},
next: function() {
if (cur < names.length) {
return attributes[Std.parseInt(names[cur++])].name();
} else {
var ns:flash.utils.Namespace = nss[cur++ - names.length];
return "xmlns:" + ns.prefix;
}
}
}
}
public function iterator():Iterator<Xml> {
if (nodeType != Xml.Element && nodeType != Xml.Document)
throw "bad nodeType";
var children:XMLList = _node.children();
var wrappers:Array<Xml> = wraps(children);
var cur = 0;
return {
hasNext: function() {
return cur < wrappers.length;
},
next: function() {
return wrappers[cur++];
}
};
}
public function elements():Iterator<Xml> {
if (nodeType != Xml.Element && nodeType != Xml.Document)
throw "bad nodeType";
var elements:XMLList = _node.elements();
var wrappers:Array<Xml> = wraps(elements);
var cur = 0;
return {
hasNext: function() {
return cur < wrappers.length;
},
next: function() {
return wrappers[cur++];
}
};
}
public function elementsNamed(name:String):Iterator<Xml> {
if (nodeType != Xml.Element && nodeType != Xml.Document)
throw "bad nodeType";
var ns = name.split(":");
var elements:XMLList;
if (ns.length == 1)
elements = _node.elements(name);
else
elements = _node.elements();
var wrappers:Array<Xml> = wraps(elements);
if (ns.length != 1)
for (w in wrappers.copy())
if (w._node.localName() != ns[1] || w._node.namespace().prefix != ns[0])
wrappers.remove(w);
var cur = 0;
return {
hasNext: function() {
return cur < wrappers.length;
},
next: function() {
return wrappers[cur++];
}
};
}
public function firstChild():Xml {
if (nodeType != Xml.Element && nodeType != Xml.Document)
throw "bad nodeType";
var children:XMLList = _node.children();
if (children.length() == 0)
return null;
return wrap(children[0]);
}
public function firstElement():Xml {
if (nodeType != Xml.Element && nodeType != Xml.Document)
throw "bad nodeType";
var elements:XMLList = _node.elements();
if (elements.length() == 0)
return null;
return wrap(elements[0]);
}
public function addChild(x:Xml):Void {
if (nodeType != Xml.Element && nodeType != Xml.Document)
throw "bad nodeType";
if (x.parent != null)
x.parent.removeChild(x);
var children:XMLList = _node.children();
_node.appendChild(x._node);
}
public function removeChild(x:Xml):Bool {
if (nodeType != Xml.Element && nodeType != Xml.Document)
throw "bad nodeType";
var children:XMLList = _node.children();
if (_node != x._node.parent())
return false;
var i = x._node.childIndex();
untyped __delete__(children, Reflect.fields(children)[i]);
return true;
}
public function insertChild(x:Xml, pos:Int):Void {
if (nodeType != Xml.Element && nodeType != Xml.Document)
throw "bad nodeType";
if (x.parent != null)
x.parent.removeChild(x);
var children:XMLList = _node.children();
if (pos < children.length())
_node.insertChildBefore(children[pos], x._node);
else
_node.appendChild(x._node);
}
public function toString():String {
XML.prettyPrinting = false;
if (nodeType == Xml.Document) {
var str = _node.toXMLString();
// remove <__document xmlns....>STR</__document> wrapper
str = str.substr(str.indexOf(">") + 1);
str = str.substr(0, str.length - 13);
return str;
}
return _node.toXMLString();
}
static function __init__():Void
untyped {
Element = "element";
PCData = "pcdata";
CData = "cdata";
Comment = "comment";
DocType = "doctype";
ProcessingInstruction = "processingInstruction";
Document = "document";
}
}

View File

@ -0,0 +1,94 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package flash;
/**
The Vector class is very similar to Array but is only supported by the Flash Player 10+
**/
@:require(flash10) extern class Vector<T> implements ArrayAccess<T> {
var length:Int;
var fixed:Bool;
function new(?length:UInt, ?fixed:Bool):Void;
function concat(?a:Vector<T>):Vector<T>;
function join(sep:String):String;
function pop():Null<T>;
function push(x:T):Int;
function reverse():Void;
function shift():Null<T>;
function unshift(x:T):Void;
function slice(?pos:Int, ?end:Int):Vector<T>;
function sort(f:T->T->Int):Void;
function splice(pos:Int, len:Int):Vector<T>;
function toString():String;
function indexOf(x:T, ?from:Int):Int;
function lastIndexOf(x:T, ?from:Int):Int;
#if flash19
function insertAt(index:Int, element:T):Void;
#else
inline function insertAt(index:Int, element:T):Void {
(cast this).splice(index, 0, element);
}
#end
@:require(flash19) function removeAt(index:Int):T;
inline static function ofArray<T>(v:Array<T>):Vector<T> {
return untyped __vector__(v);
}
inline static function convert<T, U>(v:Vector<T>):Vector<U> {
return untyped __vector__(v);
}
/**
Get a run-time value referencing the `Vector` class with concrete type parameters.
Normally in Haxe, for most of the types, type parameters are eliminated at run-time,
so there is no way to check if a value is of a type with specific type parameters.
However, on the Flash target, the `flash.Vector<T>` values carry type parameter
information at run-time all the type-checks (such as `Std.isOfType` and `Std.downcast`) on them
must be done using a `Class<T>` value that also carries the type parameters. However,
Haxe syntax does not allow creating such values and this function exists to mitigate
this limitation.
It should be used as such:
```haxe
var specificVectorType:Class<Vector<Int>> = Vector.typeReference();
trace(Std.isOfType(vec, specificVectorType));
```
or using the type-check syntax:
```haxe
trace(Std.isOfType(vec, (Vector.typeReference() : Class<Vector<Int>>)));
```
It's also helpful when working with native Flash libraries, that receive Class instances:
```haxe
new Signal((Vector.typeReference() : Class<Vector<Int>>));
```
**/
inline static function typeReference<T>():Class<Vector<T>> {
return untyped __vector__();
}
}

View File

@ -0,0 +1,123 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@:coreApi class EReg {
var r:flash.utils.RegExp;
var result:Dynamic;
public function new(r:String, opt:String):Void {
this.r = new flash.utils.RegExp(r, opt);
}
public function match(s:String):Bool {
if (r.global)
r.lastIndex = 0;
result = r.exec(s);
return (result != null);
}
public function matched(n:Int):String {
return if (result != null && n >= 0 && n < (result:Array<Dynamic>).length) result[n] else throw "EReg::matched";
}
public function matchedLeft():String {
if (result == null)
throw "No string matched";
var s:String = result.input;
return s.substr(0, result.index);
}
public function matchedRight():String {
if (result == null)
throw "No string matched";
var rl = (result.index : Int) + (result[0] : String).length;
var s:String = result.input;
return s.substr(rl, s.length - rl);
}
public function matchedPos():{pos:Int, len:Int} {
if (result == null)
throw "No string matched";
return {pos: result.index, len: (result[0] : String).length};
}
public function matchSub(s:String, pos:Int, len:Int = -1):Bool {
return if (r.global) {
r.lastIndex = pos;
result = r.exec(len < 0 ? s : s.substr(0, pos + len));
var b = result != null;
if (b) {
result.input = s;
}
b;
} else {
var b = match(len < 0 ? s.substr(pos) : s.substr(pos, len));
if (b) {
result.input = s;
result.index += pos;
}
b;
}
}
public function split(s:String):Array<String> {
// we can't use directly s.split because it's ignoring the 'g' flag
var d = "#__delim__#";
var s:String = (s : Dynamic).replace(r, d);
return s.split(d);
}
public function replace(s:String, by:String):String {
return (s : Dynamic).replace(r, by);
}
public function map(s:String, f:EReg->String):String {
var offset = 0;
var buf = new StringBuf();
var first = true;
do {
if (offset >= s.length)
break;
else if (!matchSub(s, offset)) {
buf.add(s.substr(offset));
break;
}
var p = matchedPos();
buf.add(s.substr(offset, p.pos - offset));
buf.add(f(this));
if (p.len == 0) {
buf.add(s.substr(p.pos, 1));
offset = p.pos + 1;
} else
offset = p.pos + p.len;
first = false;
} while (r.global);
if (!r.global && offset > 0 && offset < s.length)
buf.add(s.substr(offset));
return buf.toString();
}
public static inline function escape(s:String):String {
return (cast s).replace(escapeRe, "\\$&");
}
static var escapeRe = new flash.utils.RegExp("[.*+?^${}()|[\\]\\\\]", "g");
}

View File

@ -0,0 +1,131 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@:coreApi class Reflect {
public static function hasField(o:Dynamic, field:String):Bool
untyped {
return o.hasOwnProperty(field);
}
public static function field(o:Dynamic, field:String):Dynamic
untyped {
return o != null && __in__(field, o) ? o[field] : null;
}
public inline static function setField(o:Dynamic, field:String, value:Dynamic):Void
untyped {
o[field] = value;
}
public static function getProperty(o:Dynamic, field:String):Dynamic
untyped {
if (o == null)
return null;
var getter = 'get_$field';
if (__in__(getter, o)) {
return o[getter]();
}
return __in__(field, o) ? o[field] : null;
}
public static function setProperty(o:Dynamic, field:String, value:Dynamic):Void
untyped {
var setter = 'set_$field';
if (__in__(setter, o)) {
o[setter](value);
} else {
o[field] = value;
}
}
public inline static function callMethod(o:Dynamic, func:haxe.Constraints.Function, args:Array<Dynamic>):Dynamic
untyped {
return func.apply(o, args);
}
public static function fields(o:Dynamic):Array<String>
untyped {
if (o == null)
return new Array();
var i = 0;
var a = [];
while (untyped __has_next__(o, i)) {
var prop = untyped __forin__(o, i);
if (o.hasOwnProperty(prop))
a.push(prop);
}
return a;
}
public static function isFunction(f:Dynamic):Bool
untyped {
return __typeof__(f) == "function";
}
public static function compare<T>(a:T, b:T):Int {
var a:Dynamic = a;
var b:Dynamic = b;
return (a == b) ? 0 : ((a > b) ? 1 : -1);
}
public static function compareMethods(f1:Dynamic, f2:Dynamic):Bool {
return f1 == f2; // VM-level closures
}
public static function isObject(v:Dynamic):Bool
untyped {
if (v == null)
return false;
var t = __typeof__(v);
if (t == "object") {
return !isEnumValue(v);
}
return (t == "string");
}
public static function isEnumValue(v:Dynamic):Bool {
return try v.__enum__ == true catch (e:Dynamic) false;
}
public static function deleteField(o:Dynamic, field:String):Bool
untyped {
if (o.hasOwnProperty(field) != true)
return false;
__delete__(o, field);
return true;
}
public static function copy<T>(o:Null<T>):Null<T> {
if (o == null)
return null;
var o2:Dynamic = {};
for (f in Reflect.fields(o))
Reflect.setField(o2, f, Reflect.field(o, f));
return o2;
}
@:overload(function(f:Array<Dynamic>->Void):Dynamic {})
public static function makeVarArgs(f:Array<Dynamic>->Dynamic):Dynamic {
return function(__arguments__) {
return f(__arguments__);
};
}
}

View File

@ -0,0 +1,67 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
import flash.Boot;
@:coreApi class Std {
@:deprecated('Std.is is deprecated. Use Std.isOfType instead.')
public static inline function is(v:Dynamic, t:Dynamic):Bool {
return isOfType(v, t);
}
public static function isOfType(v:Dynamic, t:Dynamic):Bool {
return flash.Boot.__instanceof(v, t);
}
public static inline function downcast<T:{}, S:T>(value:T, c:Class<S>):S {
return flash.Lib.as(value, c);
}
@:deprecated('Std.instance() is deprecated. Use Std.downcast() instead.')
public static inline function instance<T:{}, S:T>(value:T, c:Class<S>):S {
return downcast(value, c);
}
public static function string(s:Dynamic):String {
return flash.Boot.__string_rec(s, "");
}
public inline static function int(x:Float):Int {
return untyped __int__(x);
}
public static function parseInt(x:String):Null<Int>
untyped {
var v = __global__["parseInt"](x);
if (__global__["isNaN"](v))
return null;
return v;
}
public static function parseFloat(x:String):Float {
return untyped __global__["parseFloat"](x);
}
public static function random(x:Int):Int {
return x <= 0 ? 0 : Math.floor(Math.random() * x);
}
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@:coreApi
extern class String {
var length(default, null):Int;
function new(string:String):Void;
function toUpperCase():String;
function toLowerCase():String;
function charAt(index:Int):String;
function charCodeAt(index:Int):Null<Int>;
function indexOf(str:String, ?startIndex:Int):Int;
function lastIndexOf(str:String, ?startIndex:Int):Int;
function split(delimiter:String):Array<String>;
function substr(pos:Int, ?len:Int):String;
function substring(startIndex:Int, ?endIndex:Int):String;
function toString():String;
@:pure static inline function fromCharCode(code:Int):String
untyped {
return code < 0x10000 ? String["fromCharCode"](code) : flash.Boot.fromCodePoint(code);
}
}

View File

@ -0,0 +1,308 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
enum ValueType {
TNull;
TInt;
TFloat;
TBool;
TObject;
TFunction;
TClass(c:Class<Dynamic>);
TEnum(e:Enum<Dynamic>);
TUnknown;
}
@:coreApi class Type {
public static function getClass<T>(o:T):Class<T>
untyped {
var cname = __global__["flash.utils.getQualifiedClassName"](o);
if (cname == "null" || cname == "Object" || cname == "int" || cname == "Number" || cname == "Boolean")
return null;
if (o.hasOwnProperty("prototype"))
return null;
var c = __as__(__global__["flash.utils.getDefinitionByName"](cname), Class);
if (c.__isenum)
return null;
return c;
}
public static function getEnum(o:EnumValue):Enum<Dynamic>
untyped {
var cname = __global__["flash.utils.getQualifiedClassName"](o);
if (cname == "null" || cname.substr(0, 8) == "builtin.")
return null;
// getEnum(Enum) should be null
if (o.hasOwnProperty("prototype"))
return null;
var c = __as__(__global__["flash.utils.getDefinitionByName"](cname), Class);
if (!c.__isenum)
return null;
return c;
}
public static function getSuperClass(c:Class<Dynamic>):Class<Dynamic>
untyped {
var cname = __global__["flash.utils.getQualifiedSuperclassName"](c);
if (cname == null || cname == "Object")
return null;
return __as__(__global__["flash.utils.getDefinitionByName"](cname), Class);
}
public static function getClassName(c:Class<Dynamic>):String {
if (c == null)
return null;
var str:String = untyped __global__["flash.utils.getQualifiedClassName"](c);
switch (str) {
case "int":
return "Int";
case "Number":
return "Float";
case "Boolean":
return "Bool";
case _:
var idx = str.lastIndexOf("::");
if (idx == -1) {
return str;
} else {
return str.substring(0, idx) + "." + str.substring(idx + 2);
}
}
}
public static function getEnumName(e:Enum<Dynamic>):String {
return getClassName(cast e);
}
public static function resolveClass(name:String):Class<Dynamic>
untyped {
var cl:Class<Dynamic>;
try {
cl = __as__(__global__["flash.utils.getDefinitionByName"](name), Class);
if (cl.__isenum)
return null;
return cl; // skip test below
} catch (e:Dynamic) {
switch (name) {
case "Int":
return Int;
case "Float":
return Float;
}
return null;
}
// ensure that this is a class
if (cl == null || cl.__name__ == null)
return null;
return cl;
}
public static function resolveEnum(name:String):Enum<Dynamic>
untyped {
var e:Dynamic;
try {
e = __global__["flash.utils.getDefinitionByName"](name);
if (!e.__isenum)
return null;
return e;
} catch (e:Dynamic) {
if (name == "Bool")
return Bool;
return null;
}
// ensure that this is an enum
if (e == null || e.__ename__ == null)
return null;
return e;
}
public static function createInstance<T>(cl:Class<T>, args:Array<Dynamic>):T
untyped {
return switch (args.length) {
case 0: __new__(cl);
case 1: __new__(cl, args[0]);
case 2: __new__(cl, args[0], args[1]);
case 3: __new__(cl, args[0], args[1], args[2]);
case 4: __new__(cl, args[0], args[1], args[2], args[3]);
case 5: __new__(cl, args[0], args[1], args[2], args[3], args[4]);
case 6: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
case 8: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
case 9: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
case 10: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
case 11: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]);
case 12: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11]);
case 13: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12]);
case 14: __new__(cl, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12],
args[13]);
default: throw "Too many arguments";
}
}
public static function createEmptyInstance<T>(cl:Class<T>):T
untyped {
try {
flash.Boot.skip_constructor = true;
var i = __new__(cl);
flash.Boot.skip_constructor = false;
return i;
} catch (e:Dynamic) {
flash.Boot.skip_constructor = false;
throw e;
}
return null;
}
public static function createEnum<T>(e:Enum<T>, constr:String, ?params:Array<Dynamic>):T {
var f:Dynamic = untyped e[constr];
if (f == null)
throw "No such constructor " + constr;
if (Reflect.isFunction(f)) {
if (params == null)
throw "Constructor " + constr + " need parameters";
return Reflect.callMethod(e, f, params);
}
if (params != null && params.length != 0)
throw "Constructor " + constr + " does not need parameters";
return f;
}
public static function createEnumIndex<T>(e:Enum<T>, index:Int, ?params:Array<Dynamic>):T {
var c:String = (untyped e.__constructs__)[index];
if (c == null)
throw index + " is not a valid enum constructor index";
return createEnum(e, c, params);
}
static function describe(t:Dynamic, fact:Bool):Array<String>
untyped {
var fields = new Array();
var xml:flash.xml.XML = __global__["flash.utils.describeType"](t);
if (fact)
xml = xml.factory[0];
var methods = xml.child("method");
for (i in 0...methods.length())
fields.push(Std.string(methods[i].attribute("name")));
var vars = xml.child("variable");
for (i in 0...vars.length())
fields.push(Std.string(vars[i].attribute("name")));
var accs = xml.child("accessor");
for (i in 0...accs.length())
fields.push(Std.string(accs[i].attribute("name")));
return fields;
}
public static function getInstanceFields(c:Class<Dynamic>):Array<String> {
return describe(c, true);
}
public static function getClassFields(c:Class<Dynamic>):Array<String> {
var a = describe(c, false);
a.remove("__construct__");
a.remove("prototype");
return a;
}
public static function getEnumConstructs(e:Enum<Dynamic>):Array<String> {
var a:Array<String> = untyped e.__constructs__;
return a.copy();
}
public static function typeof(v:Dynamic):ValueType
untyped {
var cname = __global__["flash.utils.getQualifiedClassName"](v);
switch (cname) {
case "null":
return TNull;
case "void":
return TNull; // undefined
case "int":
return TInt;
case "Number":
// integers >28 bits are stored as Numbers in avm2
if ((v < -0x10000000 || v >= 0x10000000) && Std.int(v) == v)
return TInt;
return TFloat;
case "Boolean":
return TBool;
case "Object":
return TObject;
case "Function":
return TFunction;
default:
var c:Dynamic = null;
try {
c = __global__["flash.utils.getDefinitionByName"](cname);
if (v.hasOwnProperty("prototype"))
return TObject;
if (c.__isenum)
return TEnum(c);
return TClass(c);
} catch (e:Dynamic) {
if (cname == "builtin.as$0::MethodClosure" || cname.indexOf("-") != -1)
return TFunction;
return if (c == null) TFunction else TClass(c);
}
}
return null;
}
public static function enumEq<T>(a:T, b:T):Bool
untyped {
if (a == b)
return true;
try {
if (a.index != b.index)
return false;
var ap:Array<Dynamic> = a.params;
var bp:Array<Dynamic> = b.params;
for (i in 0...ap.length)
if (!enumEq(ap[i], bp[i]))
return false;
} catch (e:Dynamic) {
return false;
}
return true;
}
public static function enumConstructor(e:EnumValue):String {
return untyped e.tag;
}
public static function enumParameters(e:EnumValue):Array<Dynamic> {
return untyped if (e.params == null) [] else e.params;
}
extern public inline static function enumIndex(e:EnumValue):Int {
return untyped e.index;
}
public static function allEnums<T>(e:Enum<T>):Array<T> {
var all = [];
var cst:Array<String> = untyped e.__constructs__;
for (c in cst) {
var v = Reflect.field(e, c);
if (!Reflect.isFunction(v))
all.push(v);
}
return all;
}
}

View File

@ -0,0 +1,100 @@
package haxe;
import flash.errors.Error;
@:coreApi
class Exception extends NativeException {
public var message(get,never):String;
public var stack(get,never):CallStack;
public var previous(get,never):Null<Exception>;
public var native(get,never):Any;
@:noCompletion var __exceptionStack:Null<CallStack>;
@:noCompletion var __nativeStack:String;
@:noCompletion @:ifFeature("haxe.Exception.get_stack") var __skipStack:Int;
@:noCompletion var __nativeException:Error;
@:noCompletion var __previousException:Null<Exception>;
static function caught(value:Any):Exception {
if(Std.isOfType(value, Exception)) {
return value;
} else if(Std.isOfType(value, Error)) {
return new Exception((value:Error).message, null, value);
} else {
return new ValueException(value, null, value);
}
}
static function thrown(value:Any):Any {
if(Std.isOfType(value, Exception)) {
return (value:Exception).native;
} else if(Std.isOfType(value, Error)) {
return value;
} else {
var e = new ValueException(value);
e.__shiftStack();
return e;
}
}
public function new(message:String, ?previous:Exception, ?native:Any) {
super(message);
__previousException = previous;
if(native != null && Std.isOfType(native, Error)) {
__nativeException = native;
__nativeStack = NativeStackTrace.normalize((native:Error).getStackTrace());
} else {
__nativeException = cast this;
__nativeStack = NativeStackTrace.callStack();
}
}
function unwrap():Any {
return __nativeException;
}
public function toString():String {
return message;
}
public function details():String {
return inline CallStack.exceptionToString(this);
}
@:noCompletion
@:ifFeature("haxe.Exception.get_stack")
inline function __shiftStack():Void {
__skipStack++;
}
function get_message():String {
return (cast this:Error).message;
}
function get_previous():Null<Exception> {
return __previousException;
}
final function get_native():Any {
return __nativeException;
}
function get_stack():CallStack {
return switch __exceptionStack {
case null:
__exceptionStack = NativeStackTrace.toHaxe(__nativeStack, __skipStack);
case s: s;
}
}
}
@:dox(hide)
@:native('flash.errors.Error')
extern class NativeException {
@:noCompletion @:flash.property private var errorID(get,never):Int;
// @:noCompletion private var message:Dynamic;
@:noCompletion private var name:Dynamic;
@:noCompletion private function new(?message:Dynamic, id:Dynamic = 0):Void;
@:noCompletion private function getStackTrace():String;
@:noCompletion private function get_errorID():Int;
}

View File

@ -0,0 +1,107 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe;
import haxe.io.Bytes;
typedef Http = HttpFlash;
class HttpFlash extends haxe.http.HttpBase {
var req:flash.net.URLLoader;
/**
Cancels `this` Http request if `request` has been called and a response
has not yet been received.
**/
public function cancel() {
if (req == null)
return;
req.close();
req = null;
}
public override function request(?post:Bool) {
responseAsString = null;
responseBytes = null;
var loader = req = new flash.net.URLLoader();
loader.dataFormat = BINARY;
loader.addEventListener("complete", function(e) {
req = null;
success(Bytes.ofData(loader.data));
});
loader.addEventListener("httpStatus", function(e:flash.events.HTTPStatusEvent) {
// on Firefox 1.5, Flash calls onHTTPStatus with 0 (!??)
if (e.status != 0)
onStatus(e.status);
});
loader.addEventListener("ioError", function(e:flash.events.IOErrorEvent) {
req = null;
responseBytes = Bytes.ofData(loader.data);
onError(e.text);
});
loader.addEventListener("securityError", function(e:flash.events.SecurityErrorEvent) {
req = null;
onError(e.text);
});
// headers
var param = false;
var vars = new flash.net.URLVariables();
for (p in params) {
param = true;
Reflect.setField(vars, p.name, p.value);
}
var small_url = url;
if (param && !post) {
var k = url.split("?");
if (k.length > 1) {
small_url = k.shift();
vars.decode(k.join("?"));
}
}
// Bug in flash player 9 ???
small_url.split("xxx");
var request = new flash.net.URLRequest(small_url);
for (h in headers)
request.requestHeaders.push(new flash.net.URLRequestHeader(h.name, h.value));
if (postData != null) {
request.data = postData;
request.method = "POST";
} else if (postBytes != null) {
request.data = postBytes.getData();
request.method = "POST";
} else {
request.data = vars;
request.method = if (post) "POST" else "GET";
}
try {
loader.load(request);
} catch (e:Dynamic) {
req = null;
onError("Exception: " + Std.string(e));
}
}
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe;
@:coreApi
#if (!haxeJSON && flash11)
@:native("JSON")
extern
#end
class Json {
#if (haxeJSON || !flash11)
inline
#end
public static function parse(text:String):Dynamic
#if (!haxeJSON && flash11); #else {
return haxe.format.JsonParser.parse(text);
} #end
#if (haxeJSON || !flash11)
inline
#end
public static function stringify(value:Dynamic, ?replacer:(key:Dynamic, value:Dynamic) -> Dynamic, ?space:String):String
#if (!haxeJSON && flash11); #else {
return haxe.format.JsonPrinter.print(value, replacer, space);
} #end
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe;
@:coreApi class Log {
public static function formatOutput(v:Dynamic, infos:PosInfos):String {
var str = Std.string(v);
if (infos == null)
return str;
var pstr = infos.fileName + ":" + infos.lineNumber;
if (infos != null && infos.customParams != null)
for (v in infos.customParams)
str += ", " + Std.string(v);
return pstr + ": " + str;
}
public static dynamic function trace(v:Dynamic, ?infos:PosInfos):Void {
#if (fdb || native_trace)
var str = formatOutput(v, infos);
untyped __global__["trace"](str);
#else
flash.Boot.__trace(v, infos);
#end
}
/**
Clears the trace output.
**/
@:hack
public static dynamic function clear():Void {
flash.Boot.__clear_trace();
}
/**
Sets the color of the trace output to `rgb`.
**/
@:hack
public static dynamic function setColor(rgb:Int):Void {
flash.Boot.__set_trace_color(rgb);
}
}

View File

@ -0,0 +1,69 @@
package haxe;
import flash.errors.Error;
import haxe.CallStack.StackItem;
/**
Do not use manually.
**/
@:dox(hide)
@:noCompletion
@:allow(haxe.Exception)
class NativeStackTrace {
@:ifFeature('haxe.NativeStackTrace.exceptionStack')
static public inline function saveStack(e:Any):Void {
}
static public inline function callStack():String {
return normalize(new Error().getStackTrace(), 1);
}
static public function exceptionStack():String {
var err:Null<Error> = untyped flash.Boot.lastError;
return err == null ? '' : normalize(err.getStackTrace());
}
static public function toHaxe(native:String, skip:Int = 0):Array<StackItem> {
var a = new Array();
var r = ~/at ([^\/]+?)\$?(\/[^\(]+)?\(\)(\[(.*?):([0-9]+)\])?/;
var rlambda = ~/^MethodInfo-([0-9]+)$/g;
var cnt = 0;
while (r.match(native)) {
native = r.matchedRight();
if(skip > cnt++) {
continue;
}
var cl = r.matched(1).split("::").join(".");
var meth = r.matched(2);
var item;
if (meth == null) {
if (rlambda.match(cl))
item = LocalFunction(Std.parseInt(rlambda.matched(1)));
else
item = Method(cl, "new");
} else
item = Method(cl, meth.substring(1));
if (r.matched(3) != null)
item = FilePos(item, r.matched(4), Std.parseInt(r.matched(5)));
a.push(item);
}
return a;
}
static function normalize(stack:String, skipItems:Int = 0):String {
switch (stack:String).substring(0, 6) {
case 'Error:' | 'Error\n': skipItems += 1;
case _:
}
return skipLines(stack, skipItems);
}
static function skipLines(stack:String, skip:Int, pos:Int = 0):String {
return if(skip > 0) {
pos = stack.indexOf('\n', pos);
return pos < 0 ? '' : skipLines(stack, --skip, pos + 1);
} else {
return stack.substring(pos);
}
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe;
@:coreApi
class Resource {
static var content:Array<{name:String}>;
public static function listNames():Array<String> {
var names = new Array();
for (x in content)
names.push(x.name);
return names;
}
public static function getString(name:String):String {
var b = resolve(name);
return b == null ? null : b.readUTFBytes(b.length);
}
public static function getBytes(name:String):haxe.io.Bytes {
var b = resolve(name);
return b == null ? null : haxe.io.Bytes.ofData(b);
}
static function resolve(name:String):flash.utils.ByteArray {
try
untyped {
var c = __as__(__global__["flash.utils.getDefinitionByName"]("_res._" + name.split(".").join("_")), Class);
return __new__(c);
} catch (e:Dynamic) {
return null;
}
}
static function __init__():Void {
content = untyped __resources__();
}
}

View File

@ -0,0 +1,142 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.ds;
@:coreApi class IntMap<T> implements haxe.Constraints.IMap<Int, T> {
private var h:flash.utils.Dictionary;
public function new():Void {
h = new flash.utils.Dictionary();
}
public inline function set(key:Int, value:T):Void {
untyped h[key] = value;
}
public inline function get(key:Int):Null<T> {
return untyped h[key];
}
public inline function exists(key:Int):Bool {
return untyped __in__(key, h);
}
public function remove(key:Int):Bool {
if (!exists(key))
return false;
untyped __delete__(h, key);
return true;
}
public inline function keys():Iterator<Int> {
return new IntMapKeysIterator(h);
}
public inline function iterator():Iterator<T> {
return new IntMapValuesIterator<T>(h);
}
@:runtime public inline function keyValueIterator():KeyValueIterator<Int, T> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():IntMap<T> {
var copied = new IntMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
var s = new StringBuf();
s.add("{");
var it = keys();
for (i in it) {
s.add(i);
s.add(" => ");
s.add(Std.string(get(i)));
if (it.hasNext())
s.add(", ");
}
s.add("}");
return s.toString();
}
public inline function clear():Void {
h = new flash.utils.Dictionary();
}
}
// this version uses __has_next__/__forin__ special SWF opcodes for iteration with no allocation
@:allow(haxe.ds.IntMap)
private class IntMapKeysIterator {
var h:flash.utils.Dictionary;
var index:Int;
var nextIndex:Int;
inline function new(h:flash.utils.Dictionary):Void {
this.h = h;
this.index = 0;
hasNext();
}
public inline function hasNext():Bool {
var h = h, index = index; // tmp vars required for __has_next
var n = untyped __has_next__(h, index);
this.nextIndex = index; // store next index
return n;
}
public inline function next():Int {
var r:Int = untyped __forin__(h, nextIndex);
index = nextIndex;
return r;
}
}
@:allow(haxe.ds.IntMap)
private class IntMapValuesIterator<T> {
var h:flash.utils.Dictionary;
var index:Int;
var nextIndex:Int;
inline function new(h:flash.utils.Dictionary):Void {
this.h = h;
this.index = 0;
hasNext();
}
public inline function hasNext():Bool {
var h = h, index = index; // tmp vars required for __has_next
var n = untyped __has_next__(h, index);
this.nextIndex = index; // store next index
return n;
}
public inline function next():T {
var r = untyped __foreach__(h, nextIndex);
index = nextIndex;
return r;
}
}

View File

@ -0,0 +1,141 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.ds;
@:coreApi
class ObjectMap<K:{}, V> extends flash.utils.Dictionary implements haxe.Constraints.IMap<K, V> {
public function new() {
super(false);
}
public inline function get(key:K):Null<V> {
return untyped this[key];
}
public inline function set(key:K, value:V):Void {
untyped this[key] = value;
}
public inline function exists(key:K):Bool {
return untyped this[key] != null;
}
public function remove(key:K):Bool {
var has = exists(key);
untyped __delete__(this, key);
return has;
}
public function keys():Iterator<K> {
return NativePropertyIterator.iterator(this);
}
public function iterator():Iterator<V> {
return NativeValueIterator.iterator(this);
}
@:runtime public inline function keyValueIterator():KeyValueIterator<K, V> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():ObjectMap<K, V> {
var copied = new ObjectMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
var s = "";
var it = keys();
for (i in it) {
s += (s == "" ? "" : ",") + Std.string(i);
s += " => ";
s += Std.string(get(i));
}
return s + "}";
}
public function clear():Void {
for (i in keys())
untyped __delete__(this, i);
}
}
private class NativePropertyIterator {
var collection:Dynamic;
var index:Int = 0;
public static inline function iterator(collection:Dynamic):NativePropertyIterator {
var result = new NativePropertyIterator();
result.collection = collection;
return result;
}
function new() {}
public inline function hasNext():Bool {
var c = collection;
var i = index;
var result = untyped __has_next__(c, i);
collection = c;
index = i;
return result;
}
public inline function next():Dynamic {
var i = index;
var result = untyped __forin__(collection, i);
index = i;
return result;
}
}
private class NativeValueIterator {
var collection:Dynamic;
var index:Int = 0;
public static inline function iterator(collection:Dynamic):NativeValueIterator {
var result = new NativeValueIterator();
result.collection = collection;
return result;
}
function new() {}
public inline function hasNext():Bool {
var c = collection;
var i = index;
var result = untyped __has_next__(c, i);
collection = c;
index = i;
return result;
}
public inline function next():Dynamic {
var i = index;
var result = untyped __foreach__(collection, i);
index = i;
return result;
}
}

View File

@ -0,0 +1,202 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.ds;
@:coreApi class StringMap<T> implements haxe.Constraints.IMap<String, T> {
private var h:Dynamic;
private var rh:Dynamic;
static var reserved = {};
public function new():Void {
h = {};
}
inline function isReserved(key:String):Bool {
return untyped __in__(key, reserved);
}
public inline function set(key:String, value:T):Void {
if (isReserved(key))
setReserved(key, value);
else
untyped h[key] = value;
}
public inline function get(key:String):Null<T> {
if (isReserved(key))
return getReserved(key);
return untyped h[key];
}
public inline function exists(key:String):Bool {
if (isReserved(key))
return existsReserved(key);
return untyped __in__(key, h);
}
function setReserved(key:String, value:T):Void {
if (rh == null)
rh = {};
untyped rh["$" + key] = value;
}
function getReserved(key:String):Null<T> {
return rh == null ? null : untyped rh["$" + key];
}
function existsReserved(key:String):Bool {
if (rh == null)
return false;
return untyped __in__("$" + key, rh);
}
public function remove(key:String):Bool {
if (isReserved(key)) {
key = "$" + key;
if (rh == null || !untyped __in__(key, rh))
return false;
untyped __delete__(rh, key);
return true;
} else {
if (!untyped __in__(key, h))
return false;
untyped __delete__(h, key);
return true;
}
}
public inline function keys():Iterator<String> {
return new StringMapKeysIterator(h, rh);
}
public inline function iterator():Iterator<T> {
return new StringMapValuesIterator<T>(h, rh);
}
@:runtime public inline function keyValueIterator():KeyValueIterator<String, T> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():StringMap<T> {
var copied = new StringMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
var s = new StringBuf();
s.add("{");
var it = keys();
for (i in it) {
s.add(i);
s.add(" => ");
s.add(Std.string(get(i)));
if (it.hasNext())
s.add(", ");
}
s.add("}");
return s.toString();
}
public inline function clear():Void {
h = {};
rh = null;
}
}
// this version uses __has_next__/__forin__ special SWF opcodes for iteration with no allocation
@:allow(haxe.ds.StringMap)
private class StringMapKeysIterator {
var h:Dynamic;
var rh:Dynamic;
var index:Int;
var nextIndex:Int;
var isReserved:Bool;
inline function new(h:Dynamic, rh:Dynamic):Void {
this.h = h;
this.rh = rh;
this.index = 0;
isReserved = false;
hasNext();
}
public inline function hasNext():Bool {
var h = h, index = index; // tmp vars required for __has_next
var n = untyped __has_next__(h, index);
if (!n && rh != null) {
h = this.h = rh;
index = this.index = 0;
rh = null;
isReserved = true;
n = untyped __has_next__(h, index);
}
this.nextIndex = index; // store next index
return n;
}
public inline function next():String {
var r:String = untyped __forin__(h, nextIndex);
index = nextIndex;
if (isReserved)
r = r.substr(1);
return r;
}
}
@:allow(haxe.ds.StringMap)
private class StringMapValuesIterator<T> {
var h:Dynamic;
var rh:Dynamic;
var index:Int;
var nextIndex:Int;
inline function new(h:Dynamic, rh:Dynamic):Void {
this.h = h;
this.rh = rh;
this.index = 0;
hasNext();
}
public inline function hasNext():Bool {
var h = h, index = index; // tmp vars required for __has_next
var n = untyped __has_next__(h, index);
if (!n && rh != null) {
h = this.h = rh;
index = this.index = 0;
rh = null;
n = untyped __has_next__(h, index);
}
this.nextIndex = index; // store next index
return n;
}
public inline function next():T {
var r = untyped __foreach__(h, nextIndex);
index = nextIndex;
return r;
}
}

View File

@ -0,0 +1,147 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.ds;
/**
This is similar to `StringMap` excepts that it does not sanitize the keys.
As a result, it will be faster to access the map for reading, but it might fail
with some reserved keys such as `constructor` or `prototype`.
**/
class UnsafeStringMap<T> implements haxe.Constraints.IMap<String, T> {
private var h:flash.utils.Dictionary;
public function new():Void {
h = new flash.utils.Dictionary();
}
public inline function set(key:String, value:T):Void {
untyped h[key] = value;
}
public inline function get(key:String):Null<T> {
return untyped h[key];
}
public inline function exists(key:String):Bool {
return untyped __in__(key, h);
}
public function remove(key:String):Bool {
if (untyped !h.hasOwnProperty(key))
return false;
untyped __delete__(h, key);
return true;
}
public inline function keys():Iterator<String> {
return new UnsafeStringMapKeysIterator(h);
}
public inline function iterator():Iterator<T> {
return new UnsafeStringMapValuesIterator<T>(h);
}
public inline function keyValueIterator():KeyValueIterator<String, T> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():UnsafeStringMap<T> {
var copied = new UnsafeStringMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
var s = new StringBuf();
s.add("{");
var it = keys();
for (i in it) {
s.add(i);
s.add(" => ");
s.add(Std.string(get(i)));
if (it.hasNext())
s.add(", ");
}
s.add("}");
return s.toString();
}
public inline function clear():Void {
h = new flash.utils.Dictionary();
}
}
// this version uses __has_next__/__forin__ special SWF opcodes for iteration with no allocation
@:allow(haxe.ds.UnsafeStringMap)
private class UnsafeStringMapKeysIterator {
var h:flash.utils.Dictionary;
var index:Int;
var nextIndex:Int;
inline function new(h:flash.utils.Dictionary):Void {
this.h = h;
this.index = 0;
hasNext();
}
public inline function hasNext():Bool {
var h = h, index = index; // tmp vars required for __has_next
var n = untyped __has_next__(h, index);
this.nextIndex = index; // store next index
return n;
}
public inline function next():String {
var r:String = untyped __forin__(h, nextIndex);
index = nextIndex;
return r;
}
}
@:allow(haxe.ds.UnsafeStringMap)
private class UnsafeStringMapValuesIterator<T> {
var h:flash.utils.Dictionary;
var index:Int;
var nextIndex:Int;
inline function new(h:flash.utils.Dictionary):Void {
this.h = h;
this.index = 0;
hasNext();
}
public inline function hasNext():Bool {
var h = h, index = index; // tmp vars required for __has_next
var n = untyped __has_next__(h, index);
this.nextIndex = index; // store next index
return n;
}
public inline function next():T {
var r = untyped __foreach__(h, nextIndex);
index = nextIndex;
return r;
}
}

View File

@ -0,0 +1,141 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.ds;
@:coreApi
class WeakMap<K:{}, V> extends flash.utils.Dictionary implements haxe.Constraints.IMap<K, V> {
public function new() {
super(true);
}
public inline function get(key:K):Null<V> {
return untyped this[key];
}
public inline function set(key:K, value:V):Void {
untyped this[key] = value;
}
public inline function exists(key:K):Bool {
return untyped this[key] != null;
}
public function remove(key:K):Bool {
var has = exists(key);
untyped __delete__(this, key);
return has;
}
public function keys():Iterator<K> {
return NativePropertyIterator.iterator(this);
}
public function iterator():Iterator<V> {
return NativeValueIterator.iterator(this);
}
public inline function keyValueIterator():KeyValueIterator<K, V> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():WeakMap<K, V> {
var copied = new WeakMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
var s = "";
var it = keys();
for (i in it) {
s += (s == "" ? "" : ",") + Std.string(i);
s += " => ";
s += Std.string(get(i));
}
return s + "}";
}
public function clear():Void {
for (i in keys())
untyped __delete__(this, i);
}
}
private class NativePropertyIterator {
var collection:Dynamic;
var index:Int = 0;
public static inline function iterator(collection:Dynamic):NativePropertyIterator {
var result = new NativePropertyIterator();
result.collection = collection;
return result;
}
function new() {}
public inline function hasNext():Bool {
var c = collection;
var i = index;
var result = untyped __has_next__(c, i);
collection = c;
index = i;
return result;
}
public inline function next():Dynamic {
var i = index;
var result = untyped __forin__(collection, i);
index = i;
return result;
}
}
private class NativeValueIterator {
var collection:Dynamic;
var index:Int = 0;
public static inline function iterator(collection:Dynamic):NativeValueIterator {
var result = new NativeValueIterator();
result.collection = collection;
return result;
}
function new() {}
public inline function hasNext():Bool {
var c = collection;
var i = index;
var result = untyped __has_next__(c, i);
collection = c;
index = i;
return result;
}
public inline function next():Dynamic {
var i = index;
var result = untyped __foreach__(collection, i);
index = i;
return result;
}
}

View File

@ -0,0 +1,54 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.zip;
@:coreApi
class Compress {
public function new(level:Int):Void {
throw new haxe.exceptions.NotImplementedException("Not implemented for this platform");
}
public function execute(src:haxe.io.Bytes, srcPos:Int, dst:haxe.io.Bytes, dstPos:Int):{done:Bool, read:Int, write:Int} {
return null;
}
public function setFlushMode(f:FlushMode):Void {}
public function close():Void {}
public static function run(s:haxe.io.Bytes, level:Int):haxe.io.Bytes {
if (s.length == 0) {
// Flash returns 0 bytes for 0 length compress (which can't be decoded on other platforms...)
var b = haxe.io.Bytes.alloc(8);
b.set(0, 0x78);
b.set(1, 0xDA);
b.set(2, 0x03);
b.set(7, 0x01);
return b;
}
var tmp = new flash.utils.ByteArray();
tmp.writeBytes(s.getData(), 0, s.length);
tmp.compress();
return haxe.io.Bytes.ofData(tmp);
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.zip;
@:coreApi
class Uncompress {
public function new(?windowBits:Int):Void {
throw new haxe.exceptions.NotImplementedException("Not implemented for this platform");
}
public function execute(src:haxe.io.Bytes, srcPos:Int, dst:haxe.io.Bytes, dstPos:Int):{done:Bool, read:Int, write:Int} {
return null;
}
public function setFlushMode(f:FlushMode):Void {}
public function close():Void {}
public static function run(src:haxe.io.Bytes, ?bufsize:Int):haxe.io.Bytes {
var tmp = new flash.utils.ByteArray();
tmp.writeBytes(src.getData(), 0, src.length);
tmp.uncompress();
return haxe.io.Bytes.ofData(tmp);
}
}

View File

@ -0,0 +1,8 @@
package flash.accessibility;
extern class Accessibility {
@:flash.property static var active(get,never) : Bool;
private static function get_active() : Bool;
static function sendEvent(source : flash.display.DisplayObject, childID : UInt, eventType : UInt, nonHTML : Bool = false) : Void;
static function updateProperties() : Void;
}

View File

@ -0,0 +1,21 @@
package flash.accessibility;
extern class AccessibilityImplementation {
var errno : UInt;
var stub : Bool;
function new() : Void;
function accDoDefaultAction(childID : UInt) : Void;
function accLocation(childID : UInt) : Dynamic;
function accSelect(operation : UInt, childID : UInt) : Void;
function getChildIDArray() : Array<Dynamic>;
function get_accDefaultAction(childID : UInt) : String;
function get_accFocus() : UInt;
function get_accName(childID : UInt) : String;
function get_accRole(childID : UInt) : UInt;
function get_accSelection() : Array<Dynamic>;
function get_accState(childID : UInt) : UInt;
function get_accValue(childID : UInt) : String;
function get_selectionActiveIndex() : Dynamic;
function get_selectionAnchorIndex() : Dynamic;
function isLabeledBy(labelBounds : flash.geom.Rectangle) : Bool;
}

View File

@ -0,0 +1,11 @@
package flash.accessibility;
extern class AccessibilityProperties {
var description : String;
var forceSimple : Bool;
var name : String;
var noAutoLabeling : Bool;
var shortcut : String;
var silent : Bool;
function new() : Void;
}

View File

@ -0,0 +1,6 @@
package flash.accessibility;
@:require(flash10_1) extern interface ISearchableText {
@:flash.property var searchText(get,never) : String;
private function get_searchText() : String;
}

View File

@ -0,0 +1,8 @@
package flash.accessibility;
@:require(flash10_1) extern interface ISimpleTextSelection {
@:flash.property var selectionActiveIndex(get,never) : Int;
@:flash.property var selectionAnchorIndex(get,never) : Int;
private function get_selectionActiveIndex() : Int;
private function get_selectionAnchorIndex() : Int;
}

View File

@ -0,0 +1,7 @@
package flash.automation;
@:require(flash10_1) extern class ActionGenerator {
function new() : Void;
function generateAction(action : AutomationAction) : Void;
function generateActions(a : Array<Dynamic>) : Void;
}

View File

@ -0,0 +1,8 @@
package flash.automation;
@:require(flash10_1) extern class AutomationAction {
@:flash.property var type(get,set) : String;
function new() : Void;
private function get_type() : String;
private function set_type(value : String) : String;
}

View File

@ -0,0 +1,9 @@
package flash.automation;
@:require(flash10_1) extern class Configuration {
@:flash.property static var deviceConfiguration(get,set) : String;
@:flash.property static var testAutomationConfiguration(get,never) : String;
private static function get_deviceConfiguration() : String;
private static function get_testAutomationConfiguration() : String;
private static function set_deviceConfiguration(value : String) : String;
}

View File

@ -0,0 +1,10 @@
package flash.automation;
@:require(flash10_1) extern class KeyboardAutomationAction extends AutomationAction {
@:flash.property var keyCode(get,set) : UInt;
function new(type : String, keyCode : UInt = 0) : Void;
private function get_keyCode() : UInt;
private function set_keyCode(value : UInt) : UInt;
static final KEY_DOWN : String;
static final KEY_UP : String;
}

View File

@ -0,0 +1,22 @@
package flash.automation;
@:require(flash10_1) extern class MouseAutomationAction extends AutomationAction {
@:flash.property var delta(get,set) : Int;
@:flash.property var stageX(get,set) : Float;
@:flash.property var stageY(get,set) : Float;
function new(type : String, stageX : Float = 0, stageY : Float = 0, delta : Int = 0) : Void;
private function get_delta() : Int;
private function get_stageX() : Float;
private function get_stageY() : Float;
private function set_delta(value : Int) : Int;
private function set_stageX(value : Float) : Float;
private function set_stageY(value : Float) : Float;
static final MIDDLE_MOUSE_DOWN : String;
static final MIDDLE_MOUSE_UP : String;
static final MOUSE_DOWN : String;
static final MOUSE_MOVE : String;
static final MOUSE_UP : String;
static final MOUSE_WHEEL : String;
static final RIGHT_MOUSE_DOWN : String;
static final RIGHT_MOUSE_UP : String;
}

View File

@ -0,0 +1,26 @@
package flash.automation;
@:require(flash10_1) extern class StageCapture extends flash.events.EventDispatcher {
@:flash.property var capturePTS(get,set) : Float;
@:flash.property var captureSource(get,set) : String;
@:flash.property var clipRect(get,set) : flash.geom.Rectangle;
@:flash.property var fileNameBase(get,set) : String;
function new() : Void;
function cancel() : Void;
function capture(type : String) : Void;
function captureBitmapData() : flash.display.BitmapData;
private function get_capturePTS() : Float;
private function get_captureSource() : String;
private function get_clipRect() : flash.geom.Rectangle;
private function get_fileNameBase() : String;
private function set_capturePTS(value : Float) : Float;
private function set_captureSource(value : String) : String;
private function set_clipRect(value : flash.geom.Rectangle) : flash.geom.Rectangle;
private function set_fileNameBase(value : String) : String;
static final CURRENT : String;
static final MULTIPLE : String;
static final NEXT : String;
static final RASTER : String;
static final SCREEN : String;
static final STAGE : String;
}

View File

@ -0,0 +1,12 @@
package flash.automation;
@:require(flash10_1) extern class StageCaptureEvent extends flash.events.Event {
@:flash.property var checksum(get,never) : UInt;
@:flash.property var pts(get,never) : Float;
@:flash.property var url(get,never) : String;
function new(type : String, bubbles : Bool = false, cancelable : Bool = false, ?url : String, checksum : UInt = 0, pts : Float = 0) : Void;
private function get_checksum() : UInt;
private function get_pts() : Float;
private function get_url() : String;
static final CAPTURE : String;
}

View File

@ -0,0 +1,12 @@
package flash.concurrent;
@:require(flash11_4) extern final class Condition {
@:flash.property var mutex(get,never) : Mutex;
function new(mutex : Mutex) : Void;
private function get_mutex() : Mutex;
function notify() : Void;
function notifyAll() : Void;
function wait(timeout : Float = -1) : Bool;
@:flash.property static var isSupported(get,never) : Bool;
private static function get_isSupported() : Bool;
}

View File

@ -0,0 +1,10 @@
package flash.concurrent;
@:require(flash11_4) extern final class Mutex {
function new() : Void;
function lock() : Void;
function tryLock() : Bool;
function unlock() : Void;
@:flash.property static var isSupported(get,never) : Bool;
private static function get_isSupported() : Bool;
}

View File

@ -0,0 +1,14 @@
package flash.desktop;
@:require(flash10) extern class Clipboard {
@:flash.property var formats(get,never) : Array<ClipboardFormats>;
function clear() : Void;
function clearData(format : ClipboardFormats) : Void;
function getData(format : ClipboardFormats, ?transferMode : ClipboardTransferMode) : flash.utils.Object;
private function get_formats() : Array<ClipboardFormats>;
function hasFormat(format : ClipboardFormats) : Bool;
function setData(format : ClipboardFormats, data : flash.utils.Object, serializable : Bool = true) : Bool;
function setDataHandler(format : ClipboardFormats, handler : flash.utils.Function, serializable : Bool = true) : Bool;
@:flash.property static var generalClipboard(get,never) : Clipboard;
private static function get_generalClipboard() : Clipboard;
}

View File

@ -0,0 +1,15 @@
package flash.desktop;
@:native("flash.desktop.ClipboardFormats") @:require(flash10) extern enum abstract ClipboardFormats(String) {
var AIR_PREFIX;
var BITMAP_FORMAT;
var FILE_LIST_FORMAT;
var FILE_PROMISE_LIST_FORMAT;
var FLASH_PREFIX;
var HTML_FORMAT;
var REFERENCE_PREFIX;
var RICH_TEXT_FORMAT;
var SERIALIZATION_PREFIX;
var TEXT_FORMAT;
var URL_FORMAT;
}

View File

@ -0,0 +1,8 @@
package flash.desktop;
@:native("flash.desktop.ClipboardTransferMode") @:require(flash10) extern enum abstract ClipboardTransferMode(String) {
var CLONE_ONLY;
var CLONE_PREFERRED;
var ORIGINAL_ONLY;
var ORIGINAL_PREFERRED;
}

View File

@ -0,0 +1,5 @@
package flash.display;
extern class AVLoader extends Loader {
function new() : Void;
}

View File

@ -0,0 +1,7 @@
package flash.display;
extern class AVM1Movie extends DisplayObject {
function new() : Void;
function addCallback(functionName : String, closure : flash.utils.Function) : Void;
function call(functionName : String, restArgs : haxe.extern.Rest<Dynamic>) : Dynamic;
}

View File

@ -0,0 +1,6 @@
package flash.display;
@:native("flash.display.ActionScriptVersion") extern enum abstract ActionScriptVersion(UInt) {
var ACTIONSCRIPT2;
var ACTIONSCRIPT3;
}

View File

@ -0,0 +1,14 @@
package flash.display;
extern class Bitmap extends DisplayObject {
@:flash.property var bitmapData(get,set) : BitmapData;
@:flash.property var pixelSnapping(get,set) : PixelSnapping;
@:flash.property var smoothing(get,set) : Bool;
function new(?bitmapData : BitmapData, ?pixelSnapping : PixelSnapping, smoothing : Bool = false) : Void;
private function get_bitmapData() : BitmapData;
private function get_pixelSnapping() : PixelSnapping;
private function get_smoothing() : Bool;
private function set_bitmapData(value : BitmapData) : BitmapData;
private function set_pixelSnapping(value : PixelSnapping) : PixelSnapping;
private function set_smoothing(value : Bool) : Bool;
}

View File

@ -0,0 +1,8 @@
package flash.display;
@:native("flash.display.BitmapCompressColorSpace") extern enum abstract BitmapCompressColorSpace(String) {
var COLORSPACE_4_2_0;
var COLORSPACE_4_2_2;
var COLORSPACE_4_4_4;
var COLORSPACE_AUTO;
}

View File

@ -0,0 +1,47 @@
package flash.display;
extern class BitmapData implements IBitmapDrawable {
@:flash.property var height(get,never) : Int;
@:flash.property var rect(get,never) : flash.geom.Rectangle;
@:flash.property var transparent(get,never) : Bool;
@:flash.property var width(get,never) : Int;
function new(width : Int, height : Int, transparent : Bool = true, fillColor : UInt = 0xFFFFFFFF) : Void;
function applyFilter(sourceBitmapData : BitmapData, sourceRect : flash.geom.Rectangle, destPoint : flash.geom.Point, filter : flash.filters.BitmapFilter) : Void;
function clone() : BitmapData;
function colorTransform(rect : flash.geom.Rectangle, colorTransform : flash.geom.ColorTransform) : Void;
function compare(otherBitmapData : BitmapData) : flash.utils.Object;
function copyChannel(sourceBitmapData : BitmapData, sourceRect : flash.geom.Rectangle, destPoint : flash.geom.Point, sourceChannel : UInt, destChannel : UInt) : Void;
function copyPixels(sourceBitmapData : BitmapData, sourceRect : flash.geom.Rectangle, destPoint : flash.geom.Point, ?alphaBitmapData : BitmapData, ?alphaPoint : flash.geom.Point, mergeAlpha : Bool = false) : Void;
@:require(flash11_4) function copyPixelsToByteArray(rect : flash.geom.Rectangle, data : flash.utils.ByteArray) : Void;
function dispose() : Void;
function draw(source : IBitmapDrawable, ?matrix : flash.geom.Matrix, ?colorTransform : flash.geom.ColorTransform, ?blendMode : BlendMode, ?clipRect : flash.geom.Rectangle, smoothing : Bool = false) : Void;
@:require(flash11_3) function drawWithQuality(source : IBitmapDrawable, ?matrix : flash.geom.Matrix, ?colorTransform : flash.geom.ColorTransform, ?blendMode : BlendMode, ?clipRect : flash.geom.Rectangle, smoothing : Bool = false, ?quality : StageQuality) : Void;
@:require(flash11_3) function encode(rect : flash.geom.Rectangle, compressor : flash.utils.Object, ?byteArray : flash.utils.ByteArray) : flash.utils.ByteArray;
function fillRect(rect : flash.geom.Rectangle, color : UInt) : Void;
function floodFill(x : Int, y : Int, color : UInt) : Void;
function generateFilterRect(sourceRect : flash.geom.Rectangle, filter : flash.filters.BitmapFilter) : flash.geom.Rectangle;
function getColorBoundsRect(mask : UInt, color : UInt, findColor : Bool = true) : flash.geom.Rectangle;
function getPixel(x : Int, y : Int) : UInt;
function getPixel32(x : Int, y : Int) : UInt;
function getPixels(rect : flash.geom.Rectangle) : flash.utils.ByteArray;
@:require(flash10) function getVector(rect : flash.geom.Rectangle) : flash.Vector<UInt>;
private function get_height() : Int;
private function get_rect() : flash.geom.Rectangle;
private function get_transparent() : Bool;
private function get_width() : Int;
@:require(flash10) function histogram(?hRect : flash.geom.Rectangle) : flash.Vector<flash.Vector<Float>>;
function hitTest(firstPoint : flash.geom.Point, firstAlphaThreshold : UInt, secondObject : flash.utils.Object, ?secondBitmapDataPoint : flash.geom.Point, secondAlphaThreshold : UInt = 1) : Bool;
function lock() : Void;
function merge(sourceBitmapData : BitmapData, sourceRect : flash.geom.Rectangle, destPoint : flash.geom.Point, redMultiplier : UInt, greenMultiplier : UInt, blueMultiplier : UInt, alphaMultiplier : UInt) : Void;
function noise(randomSeed : Int, low : UInt = 0, high : UInt = 255, channelOptions : UInt = 7, grayScale : Bool = false) : Void;
function paletteMap(sourceBitmapData : BitmapData, sourceRect : flash.geom.Rectangle, destPoint : flash.geom.Point, ?redArray : Array<Int>, ?greenArray : Array<Int>, ?blueArray : Array<Int>, ?alphaArray : Array<Int>) : Void;
function perlinNoise(baseX : Float, baseY : Float, numOctaves : UInt, randomSeed : Int, stitch : Bool, fractalNoise : Bool, channelOptions : UInt = 7, grayScale : Bool = false, ?offsets : Array<flash.geom.Point>) : Void;
function pixelDissolve(sourceBitmapData : BitmapData, sourceRect : flash.geom.Rectangle, destPoint : flash.geom.Point, randomSeed : Int = 0, numPixels : Int = 0, fillColor : UInt = 0) : Int;
function scroll(x : Int, y : Int) : Void;
function setPixel(x : Int, y : Int, color : UInt) : Void;
function setPixel32(x : Int, y : Int, color : UInt) : Void;
function setPixels(rect : flash.geom.Rectangle, inputByteArray : flash.utils.ByteArray) : Void;
@:require(flash10) function setVector(rect : flash.geom.Rectangle, inputVector : flash.Vector<UInt>) : Void;
function threshold(sourceBitmapData : BitmapData, sourceRect : flash.geom.Rectangle, destPoint : flash.geom.Point, operation : String, threshold : UInt, color : UInt = 0, mask : UInt = 0xFFFFFFFF, copySource : Bool = false) : UInt;
function unlock(?changeRect : flash.geom.Rectangle) : Void;
}

View File

@ -0,0 +1,8 @@
package flash.display;
extern class BitmapDataChannel {
public static inline var ALPHA = 8;
public static inline var BLUE = 4;
public static inline var GREEN = 2;
public static inline var RED = 1;
}

View File

@ -0,0 +1,8 @@
package flash.display;
@:native("flash.display.BitmapEncodingColorSpace") extern enum abstract BitmapEncodingColorSpace(String) {
var COLORSPACE_4_2_0;
var COLORSPACE_4_2_2;
var COLORSPACE_4_4_4;
var COLORSPACE_AUTO;
}

View File

@ -0,0 +1,19 @@
package flash.display;
@:native("flash.display.BlendMode") extern enum abstract BlendMode(String) {
var ADD;
var ALPHA;
var DARKEN;
var DIFFERENCE;
var ERASE;
var HARDLIGHT;
var INVERT;
var LAYER;
var LIGHTEN;
var MULTIPLY;
var NORMAL;
var OVERLAY;
var SCREEN;
var SHADER;
var SUBTRACT;
}

View File

@ -0,0 +1,7 @@
package flash.display;
@:native("flash.display.CapsStyle") extern enum abstract CapsStyle(String) {
var NONE;
var ROUND;
var SQUARE;
}

View File

@ -0,0 +1,7 @@
package flash.display;
@:native("flash.display.ColorCorrection") @:require(flash10_1) extern enum abstract ColorCorrection(String) {
var DEFAULT;
var OFF;
var ON;
}

View File

@ -0,0 +1,7 @@
package flash.display;
@:native("flash.display.ColorCorrectionSupport") @:require(flash10_1) extern enum abstract ColorCorrectionSupport(String) {
var DEFAULT_OFF;
var DEFAULT_ON;
var UNSUPPORTED;
}

View File

@ -0,0 +1,100 @@
package flash.display;
extern class DisplayObject extends flash.events.EventDispatcher implements IBitmapDrawable {
@:flash.property var accessibilityProperties(get,set) : flash.accessibility.AccessibilityProperties;
@:flash.property var alpha(get,set) : Float;
@:flash.property var blendMode(get,set) : BlendMode;
@:flash.property @:require(flash10) var blendShader(never,set) : Shader;
@:flash.property var cacheAsBitmap(get,set) : Bool;
@:flash.property var filters(get,set) : Array<flash.filters.BitmapFilter>;
@:flash.property var height(get,set) : Float;
@:flash.property var loaderInfo(get,never) : LoaderInfo;
@:flash.property var mask(get,set) : DisplayObject;
@:flash.property var mouseX(get,never) : Float;
@:flash.property var mouseY(get,never) : Float;
@:flash.property var name(get,set) : String;
@:flash.property var opaqueBackground(get,set) : Null<UInt>;
@:flash.property var parent(get,never) : DisplayObjectContainer;
@:flash.property var root(get,never) : DisplayObject;
@:flash.property var rotation(get,set) : Float;
@:flash.property @:require(flash10) var rotationX(get,set) : Float;
@:flash.property @:require(flash10) var rotationY(get,set) : Float;
@:flash.property @:require(flash10) var rotationZ(get,set) : Float;
@:flash.property var scale9Grid(get,set) : flash.geom.Rectangle;
@:flash.property var scaleX(get,set) : Float;
@:flash.property var scaleY(get,set) : Float;
@:flash.property @:require(flash10) var scaleZ(get,set) : Float;
@:flash.property var scrollRect(get,set) : flash.geom.Rectangle;
@:flash.property var stage(get,never) : Stage;
@:flash.property var transform(get,set) : flash.geom.Transform;
@:flash.property var visible(get,set) : Bool;
@:flash.property var width(get,set) : Float;
@:flash.property var x(get,set) : Float;
@:flash.property var y(get,set) : Float;
@:flash.property @:require(flash10) var z(get,set) : Float;
function getBounds(targetCoordinateSpace : DisplayObject) : flash.geom.Rectangle;
function getRect(targetCoordinateSpace : DisplayObject) : flash.geom.Rectangle;
private function get_accessibilityProperties() : flash.accessibility.AccessibilityProperties;
private function get_alpha() : Float;
private function get_blendMode() : BlendMode;
private function get_cacheAsBitmap() : Bool;
private function get_filters() : Array<flash.filters.BitmapFilter>;
private function get_height() : Float;
private function get_loaderInfo() : LoaderInfo;
private function get_mask() : DisplayObject;
private function get_metaData() : Dynamic;
private function get_mouseX() : Float;
private function get_mouseY() : Float;
private function get_name() : String;
private function get_opaqueBackground() : Null<UInt>;
private function get_parent() : DisplayObjectContainer;
private function get_root() : DisplayObject;
private function get_rotation() : Float;
private function get_rotationX() : Float;
private function get_rotationY() : Float;
private function get_rotationZ() : Float;
private function get_scale9Grid() : flash.geom.Rectangle;
private function get_scaleX() : Float;
private function get_scaleY() : Float;
private function get_scaleZ() : Float;
private function get_scrollRect() : flash.geom.Rectangle;
private function get_stage() : Stage;
private function get_transform() : flash.geom.Transform;
private function get_visible() : Bool;
private function get_width() : Float;
private function get_x() : Float;
private function get_y() : Float;
private function get_z() : Float;
function globalToLocal(point : flash.geom.Point) : flash.geom.Point;
@:require(flash10) function globalToLocal3D(point : flash.geom.Point) : flash.geom.Vector3D;
function hitTestObject(obj : DisplayObject) : Bool;
function hitTestPoint(x : Float, y : Float, shapeFlag : Bool = false) : Bool;
@:require(flash10) function local3DToGlobal(point3d : flash.geom.Vector3D) : flash.geom.Point;
function localToGlobal(point : flash.geom.Point) : flash.geom.Point;
private function set_accessibilityProperties(value : flash.accessibility.AccessibilityProperties) : flash.accessibility.AccessibilityProperties;
private function set_alpha(value : Float) : Float;
private function set_blendMode(value : BlendMode) : BlendMode;
private function set_blendShader(value : Shader) : Shader;
private function set_cacheAsBitmap(value : Bool) : Bool;
private function set_filters(value : Array<flash.filters.BitmapFilter>) : Array<flash.filters.BitmapFilter>;
private function set_height(value : Float) : Float;
private function set_mask(value : DisplayObject) : DisplayObject;
private function set_metaData(value : Dynamic) : Dynamic;
private function set_name(value : String) : String;
private function set_opaqueBackground(value : Null<UInt>) : Null<UInt>;
private function set_rotation(value : Float) : Float;
private function set_rotationX(value : Float) : Float;
private function set_rotationY(value : Float) : Float;
private function set_rotationZ(value : Float) : Float;
private function set_scale9Grid(value : flash.geom.Rectangle) : flash.geom.Rectangle;
private function set_scaleX(value : Float) : Float;
private function set_scaleY(value : Float) : Float;
private function set_scaleZ(value : Float) : Float;
private function set_scrollRect(value : flash.geom.Rectangle) : flash.geom.Rectangle;
private function set_transform(value : flash.geom.Transform) : flash.geom.Transform;
private function set_visible(value : Bool) : Bool;
private function set_width(value : Float) : Float;
private function set_x(value : Float) : Float;
private function set_y(value : Float) : Float;
private function set_z(value : Float) : Float;
}

View File

@ -0,0 +1,30 @@
package flash.display;
extern class DisplayObjectContainer extends InteractiveObject {
@:flash.property var mouseChildren(get,set) : Bool;
@:flash.property var numChildren(get,never) : Int;
@:flash.property var tabChildren(get,set) : Bool;
@:flash.property var textSnapshot(get,never) : flash.text.TextSnapshot;
function new() : Void;
function addChild(child : DisplayObject) : DisplayObject;
function addChildAt(child : DisplayObject, index : Int) : DisplayObject;
function areInaccessibleObjectsUnderPoint(point : flash.geom.Point) : Bool;
function contains(child : DisplayObject) : Bool;
function getChildAt(index : Int) : DisplayObject;
function getChildByName(name : String) : DisplayObject;
function getChildIndex(child : DisplayObject) : Int;
function getObjectsUnderPoint(point : flash.geom.Point) : Array<DisplayObject>;
private function get_mouseChildren() : Bool;
private function get_numChildren() : Int;
private function get_tabChildren() : Bool;
private function get_textSnapshot() : flash.text.TextSnapshot;
function removeChild(child : DisplayObject) : DisplayObject;
function removeChildAt(index : Int) : DisplayObject;
@:require(flash11) function removeChildren(beginIndex : Int = 0, endIndex : Int = 2147483647) : Void;
function setChildIndex(child : DisplayObject, index : Int) : Void;
private function set_mouseChildren(value : Bool) : Bool;
private function set_tabChildren(value : Bool) : Bool;
@:require(flash11_8) function stopAllMovieClips() : Void;
function swapChildren(child1 : DisplayObject, child2 : DisplayObject) : Void;
function swapChildrenAt(index1 : Int, index2 : Int) : Void;
}

View File

@ -0,0 +1,7 @@
package flash.display;
@:native("flash.display.FocusDirection") @:require(flash10_1) extern enum abstract FocusDirection(String) {
var BOTTOM;
var NONE;
var TOP;
}

View File

@ -0,0 +1,9 @@
package flash.display;
extern final class FrameLabel extends flash.events.EventDispatcher {
@:flash.property var frame(get,never) : Int;
@:flash.property var name(get,never) : String;
function new(name : String, frame : Int) : Void;
private function get_frame() : Int;
private function get_name() : String;
}

View File

@ -0,0 +1,6 @@
package flash.display;
@:native("flash.display.GradientType") extern enum abstract GradientType(String) {
var LINEAR;
var RADIAL;
}

View File

@ -0,0 +1,29 @@
package flash.display;
extern final class Graphics {
function new() : Void;
function beginBitmapFill(bitmap : BitmapData, ?matrix : flash.geom.Matrix, repeat : Bool = true, smooth : Bool = false) : Void;
function beginFill(color : UInt, alpha : Float = 1) : Void;
function beginGradientFill(type : GradientType, colors : Array<UInt>, alphas : Array<Dynamic>, ratios : Array<Dynamic>, ?matrix : flash.geom.Matrix, ?spreadMethod : SpreadMethod, ?interpolationMethod : InterpolationMethod, focalPointRatio : Float = 0) : Void;
@:require(flash10) function beginShaderFill(shader : Shader, ?matrix : flash.geom.Matrix) : Void;
function clear() : Void;
@:require(flash10) function copyFrom(sourceGraphics : Graphics) : Void;
@:require(flash11) function cubicCurveTo(controlX1 : Float, controlY1 : Float, controlX2 : Float, controlY2 : Float, anchorX : Float, anchorY : Float) : Void;
function curveTo(controlX : Float, controlY : Float, anchorX : Float, anchorY : Float) : Void;
function drawCircle(x : Float, y : Float, radius : Float) : Void;
function drawEllipse(x : Float, y : Float, width : Float, height : Float) : Void;
@:require(flash10) function drawGraphicsData(graphicsData : flash.Vector<IGraphicsData>) : Void;
@:require(flash10) function drawPath(commands : flash.Vector<Int>, data : flash.Vector<Float>, ?winding : GraphicsPathWinding) : Void;
function drawRect(x : Float, y : Float, width : Float, height : Float) : Void;
function drawRoundRect(x : Float, y : Float, width : Float, height : Float, ellipseWidth : Float, ellipseHeight : Null<Float> = 0) : Void;
function drawRoundRectComplex(x : Float, y : Float, width : Float, height : Float, topLeftRadius : Float, topRightRadius : Float, bottomLeftRadius : Float, bottomRightRadius : Float) : Void;
@:require(flash10) function drawTriangles(vertices : flash.Vector<Float>, ?indices : flash.Vector<Int>, ?uvtData : flash.Vector<Float>, ?culling : TriangleCulling) : Void;
function endFill() : Void;
@:require(flash10) function lineBitmapStyle(bitmap : BitmapData, ?matrix : flash.geom.Matrix, repeat : Bool = true, smooth : Bool = false) : Void;
function lineGradientStyle(type : GradientType, colors : Array<UInt>, alphas : Array<Dynamic>, ratios : Array<Dynamic>, ?matrix : flash.geom.Matrix, ?spreadMethod : SpreadMethod, ?interpolationMethod : InterpolationMethod, focalPointRatio : Float = 0) : Void;
@:require(flash10) function lineShaderStyle(shader : Shader, ?matrix : flash.geom.Matrix) : Void;
function lineStyle(thickness : Null<Float> = 0, color : UInt = 0, alpha : Float = 1, pixelHinting : Bool = false, ?scaleMode : LineScaleMode, ?caps : CapsStyle, ?joints : JointStyle, miterLimit : Float = 3) : Void;
function lineTo(x : Float, y : Float) : Void;
function moveTo(x : Float, y : Float) : Void;
@:require(flash11_6) function readGraphicsData(recurse : Bool = true) : flash.Vector<IGraphicsData>;
}

View File

@ -0,0 +1,9 @@
package flash.display;
extern final class GraphicsBitmapFill implements IGraphicsData implements IGraphicsFill {
var bitmapData : BitmapData;
var matrix : flash.geom.Matrix;
var repeat : Bool;
var smooth : Bool;
function new(?bitmapData : BitmapData, ?matrix : flash.geom.Matrix, repeat : Bool = true, smooth : Bool = false) : Void;
}

View File

@ -0,0 +1,5 @@
package flash.display;
extern class GraphicsEndFill implements IGraphicsData implements IGraphicsFill {
function new() : Void;
}

View File

@ -0,0 +1,19 @@
package flash.display;
extern final class GraphicsGradientFill implements IGraphicsData implements IGraphicsFill {
var alphas : Array<Float>;
var colors : Array<UInt>;
var focalPointRatio : Float;
@:flash.property var interpolationMethod(get,set) : InterpolationMethod;
var matrix : flash.geom.Matrix;
var ratios : Array<Float>;
@:flash.property var spreadMethod(get,set) : SpreadMethod;
@:flash.property var type(get,set) : GradientType;
function new(?type : GradientType, ?colors : Array<UInt>, ?alphas : Array<Float>, ?ratios : Array<Float>, ?matrix : flash.geom.Matrix, ?spreadMethod : SpreadMethod, ?interpolationMethod : InterpolationMethod, focalPointRatio : Float = 0) : Void;
private function get_interpolationMethod() : InterpolationMethod;
private function get_spreadMethod() : SpreadMethod;
private function get_type() : GradientType;
private function set_interpolationMethod(value : InterpolationMethod) : InterpolationMethod;
private function set_spreadMethod(value : SpreadMethod) : SpreadMethod;
private function set_type(value : GradientType) : GradientType;
}

View File

@ -0,0 +1,16 @@
package flash.display;
extern final class GraphicsPath implements IGraphicsData implements IGraphicsPath {
var commands : flash.Vector<Int>;
var data : flash.Vector<Float>;
@:flash.property var winding(get,set) : GraphicsPathWinding;
function new(?commands : flash.Vector<Int>, ?data : flash.Vector<Float>, ?winding : GraphicsPathWinding) : Void;
@:require(flash11) function cubicCurveTo(controlX1 : Float, controlY1 : Float, controlX2 : Float, controlY2 : Float, anchorX : Float, anchorY : Float) : Void;
function curveTo(controlX : Float, controlY : Float, anchorX : Float, anchorY : Float) : Void;
private function get_winding() : GraphicsPathWinding;
function lineTo(x : Float, y : Float) : Void;
function moveTo(x : Float, y : Float) : Void;
private function set_winding(value : GraphicsPathWinding) : GraphicsPathWinding;
function wideLineTo(x : Float, y : Float) : Void;
function wideMoveTo(x : Float, y : Float) : Void;
}

View File

@ -0,0 +1,11 @@
package flash.display;
extern class GraphicsPathCommand {
public static inline var LINE_TO = 2;
public static inline var MOVE_TO = 1;
public static inline var CURVE_TO = 3;
@:require(flash11) public static inline var CUBIC_CURVE_TO = 6;
public static inline var WIDE_LINE_TO = 5;
public static inline var WIDE_MOVE_TO = 4;
public static inline var NO_OP = 0;
}

View File

@ -0,0 +1,6 @@
package flash.display;
@:native("flash.display.GraphicsPathWinding") extern enum abstract GraphicsPathWinding(String) {
var EVEN_ODD;
var NON_ZERO;
}

View File

@ -0,0 +1,7 @@
package flash.display;
extern final class GraphicsShaderFill implements IGraphicsData implements IGraphicsFill {
var matrix : flash.geom.Matrix;
var shader : Shader;
function new(?shader : Shader, ?matrix : flash.geom.Matrix) : Void;
}

View File

@ -0,0 +1,7 @@
package flash.display;
extern final class GraphicsSolidFill implements IGraphicsData implements IGraphicsFill {
var alpha : Float;
var color : UInt;
function new(color : UInt = 0, alpha : Float = 1) : Void;
}

View File

@ -0,0 +1,18 @@
package flash.display;
extern final class GraphicsStroke implements IGraphicsData implements IGraphicsStroke {
@:flash.property var caps(get,set) : CapsStyle;
var fill : IGraphicsFill;
@:flash.property var joints(get,set) : JointStyle;
var miterLimit : Float;
var pixelHinting : Bool;
@:flash.property var scaleMode(get,set) : LineScaleMode;
var thickness : Float;
function new(thickness : Float = 0./*NaN*/, pixelHinting : Bool = false, ?scaleMode : LineScaleMode, ?caps : CapsStyle, ?joints : JointStyle, miterLimit : Float = 3, ?fill : IGraphicsFill) : Void;
private function get_caps() : CapsStyle;
private function get_joints() : JointStyle;
private function get_scaleMode() : LineScaleMode;
private function set_caps(value : CapsStyle) : CapsStyle;
private function set_joints(value : JointStyle) : JointStyle;
private function set_scaleMode(value : LineScaleMode) : LineScaleMode;
}

View File

@ -0,0 +1,11 @@
package flash.display;
extern final class GraphicsTrianglePath implements IGraphicsData implements IGraphicsPath {
@:flash.property var culling(get,set) : TriangleCulling;
var indices : flash.Vector<Int>;
var uvtData : flash.Vector<Float>;
var vertices : flash.Vector<Float>;
function new(?vertices : flash.Vector<Float>, ?indices : flash.Vector<Int>, ?uvtData : flash.Vector<Float>, ?culling : TriangleCulling) : Void;
private function get_culling() : TriangleCulling;
private function set_culling(value : TriangleCulling) : TriangleCulling;
}

View File

@ -0,0 +1,4 @@
package flash.display;
extern interface IBitmapCompressOptions {
}

View File

@ -0,0 +1,4 @@
package flash.display;
extern interface IBitmapDrawable {
}

View File

@ -0,0 +1,4 @@
package flash.display;
extern interface IDrawCommand {
}

View File

@ -0,0 +1,4 @@
package flash.display;
extern interface IGraphicsData {
}

View File

@ -0,0 +1,4 @@
package flash.display;
extern interface IGraphicsFill {
}

View File

@ -0,0 +1,4 @@
package flash.display;
extern interface IGraphicsPath {
}

View File

@ -0,0 +1,4 @@
package flash.display;
extern interface IGraphicsStroke {
}

View File

@ -0,0 +1,33 @@
package flash.display;
extern class InteractiveObject extends DisplayObject {
@:flash.property var accessibilityImplementation(get,set) : flash.accessibility.AccessibilityImplementation;
@:flash.property var contextMenu(get,set) : flash.ui.ContextMenu;
@:flash.property var doubleClickEnabled(get,set) : Bool;
@:flash.property var focusRect(get,set) : Dynamic;
@:flash.property var mouseEnabled(get,set) : Bool;
@:flash.property @:require(flash11) var needsSoftKeyboard(get,set) : Bool;
@:flash.property @:require(flash11) var softKeyboardInputAreaOfInterest(get,set) : flash.geom.Rectangle;
@:flash.property var tabEnabled(get,set) : Bool;
@:flash.property var tabIndex(get,set) : Int;
function new() : Void;
private function get_accessibilityImplementation() : flash.accessibility.AccessibilityImplementation;
private function get_contextMenu() : flash.ui.ContextMenu;
private function get_doubleClickEnabled() : Bool;
private function get_focusRect() : Dynamic;
private function get_mouseEnabled() : Bool;
private function get_needsSoftKeyboard() : Bool;
private function get_softKeyboardInputAreaOfInterest() : flash.geom.Rectangle;
private function get_tabEnabled() : Bool;
private function get_tabIndex() : Int;
@:require(flash11) function requestSoftKeyboard() : Bool;
private function set_accessibilityImplementation(value : flash.accessibility.AccessibilityImplementation) : flash.accessibility.AccessibilityImplementation;
private function set_contextMenu(value : flash.ui.ContextMenu) : flash.ui.ContextMenu;
private function set_doubleClickEnabled(value : Bool) : Bool;
private function set_focusRect(value : Dynamic) : Dynamic;
private function set_mouseEnabled(value : Bool) : Bool;
private function set_needsSoftKeyboard(value : Bool) : Bool;
private function set_softKeyboardInputAreaOfInterest(value : flash.geom.Rectangle) : flash.geom.Rectangle;
private function set_tabEnabled(value : Bool) : Bool;
private function set_tabIndex(value : Int) : Int;
}

View File

@ -0,0 +1,6 @@
package flash.display;
@:native("flash.display.InterpolationMethod") extern enum abstract InterpolationMethod(String) {
var LINEAR_RGB;
var RGB;
}

View File

@ -0,0 +1,6 @@
package flash.display;
extern final class JPEGCompressOptions implements IBitmapCompressOptions {
var quality : UInt;
function new(quality : UInt = 80) : Void;
}

View File

@ -0,0 +1,6 @@
package flash.display;
extern final class JPEGEncoderOptions {
var quality : UInt;
function new(quality : UInt = 80) : Void;
}

View File

@ -0,0 +1,8 @@
package flash.display;
extern final class JPEGXRCompressOptions implements IBitmapCompressOptions {
var colorSpace : String;
var quantization : UInt;
var trimFlexBits : UInt;
function new(quantization : UInt = 20, ?colorSpace : String, trimFlexBits : UInt = 0) : Void;
}

View File

@ -0,0 +1,8 @@
package flash.display;
extern final class JPEGXREncoderOptions {
var colorSpace : BitmapEncodingColorSpace;
var quantization : UInt;
var trimFlexBits : UInt;
function new(quantization : UInt = 20, ?colorSpace : BitmapEncodingColorSpace, trimFlexBits : UInt = 0) : Void;
}

View File

@ -0,0 +1,7 @@
package flash.display;
@:native("flash.display.JointStyle") extern enum abstract JointStyle(String) {
var BEVEL;
var MITER;
var ROUND;
}

View File

@ -0,0 +1,8 @@
package flash.display;
@:native("flash.display.LineScaleMode") extern enum abstract LineScaleMode(String) {
var HORIZONTAL;
var NONE;
var NORMAL;
var VERTICAL;
}

View File

@ -0,0 +1,16 @@
package flash.display;
extern class Loader extends DisplayObjectContainer {
@:flash.property var content(get,never) : DisplayObject;
@:flash.property var contentLoaderInfo(get,never) : LoaderInfo;
@:flash.property @:require(flash10_1) var uncaughtErrorEvents(get,never) : flash.events.UncaughtErrorEvents;
function new() : Void;
function close() : Void;
private function get_content() : DisplayObject;
private function get_contentLoaderInfo() : LoaderInfo;
private function get_uncaughtErrorEvents() : flash.events.UncaughtErrorEvents;
function load(request : flash.net.URLRequest, ?context : flash.system.LoaderContext) : Void;
function loadBytes(bytes : flash.utils.ByteArray, ?context : flash.system.LoaderContext) : Void;
function unload() : Void;
@:require(flash10) function unloadAndStop(gc : Bool = true) : Void;
}

View File

@ -0,0 +1,53 @@
package flash.display;
extern class LoaderInfo extends flash.events.EventDispatcher {
@:flash.property var actionScriptVersion(get,never) : ActionScriptVersion;
@:flash.property var applicationDomain(get,never) : flash.system.ApplicationDomain;
@:flash.property var bytes(get,never) : flash.utils.ByteArray;
@:flash.property var bytesLoaded(get,never) : UInt;
@:flash.property var bytesTotal(get,never) : UInt;
@:flash.property var childAllowsParent(get,never) : Bool;
@:flash.property @:require(flash11_4) var childSandboxBridge(get,set) : Dynamic;
@:flash.property var content(get,never) : DisplayObject;
@:flash.property var contentType(get,never) : String;
@:flash.property var frameRate(get,never) : Float;
@:flash.property var height(get,never) : Int;
@:flash.property @:require(flash10_1) var isURLInaccessible(get,never) : Bool;
@:flash.property var loader(get,never) : Loader;
@:flash.property var loaderURL(get,never) : String;
@:flash.property var parameters(get,never) : Dynamic<String>;
@:flash.property var parentAllowsChild(get,never) : Bool;
@:flash.property @:require(flash11_4) var parentSandboxBridge(get,set) : Dynamic;
@:flash.property var sameDomain(get,never) : Bool;
@:flash.property var sharedEvents(get,never) : flash.events.EventDispatcher;
@:flash.property var swfVersion(get,never) : UInt;
@:flash.property @:require(flash10_1) var uncaughtErrorEvents(get,never) : flash.events.UncaughtErrorEvents;
@:flash.property var url(get,never) : String;
@:flash.property var width(get,never) : Int;
private function get_actionScriptVersion() : ActionScriptVersion;
private function get_applicationDomain() : flash.system.ApplicationDomain;
private function get_bytes() : flash.utils.ByteArray;
private function get_bytesLoaded() : UInt;
private function get_bytesTotal() : UInt;
private function get_childAllowsParent() : Bool;
private function get_childSandboxBridge() : Dynamic;
private function get_content() : DisplayObject;
private function get_contentType() : String;
private function get_frameRate() : Float;
private function get_height() : Int;
private function get_isURLInaccessible() : Bool;
private function get_loader() : Loader;
private function get_loaderURL() : String;
private function get_parameters() : Dynamic<String>;
private function get_parentAllowsChild() : Bool;
private function get_parentSandboxBridge() : Dynamic;
private function get_sameDomain() : Bool;
private function get_sharedEvents() : flash.events.EventDispatcher;
private function get_swfVersion() : UInt;
private function get_uncaughtErrorEvents() : flash.events.UncaughtErrorEvents;
private function get_url() : String;
private function get_width() : Int;
private function set_childSandboxBridge(value : Dynamic) : Dynamic;
private function set_parentSandboxBridge(value : Dynamic) : Dynamic;
static function getLoaderInfoByDefinition(object : Dynamic) : LoaderInfo;
}

View File

@ -0,0 +1,4 @@
package flash.display;
extern class MorphShape extends DisplayObject {
}

View File

@ -0,0 +1,38 @@
package flash.display;
extern class MovieClip extends Sprite #if !flash_strict implements Dynamic #end {
@:flash.property var currentFrame(get,never) : Int;
@:flash.property @:require(flash10) var currentFrameLabel(get,never) : String;
@:flash.property var currentLabel(get,never) : String;
@:flash.property var currentLabels(get,never) : Array<FrameLabel>;
@:flash.property var currentScene(get,never) : Scene;
@:flash.property var enabled(get,set) : Bool;
@:flash.property var framesLoaded(get,never) : Int;
@:flash.property @:require(flash11) var isPlaying(get,never) : Bool;
@:flash.property var scenes(get,never) : Array<Scene>;
@:flash.property var totalFrames(get,never) : Int;
@:flash.property var trackAsMenu(get,set) : Bool;
function new() : Void;
function addFrameScript(restArgs : haxe.extern.Rest<Dynamic>) : Void;
private function get_currentFrame() : Int;
private function get_currentFrameLabel() : String;
private function get_currentLabel() : String;
private function get_currentLabels() : Array<FrameLabel>;
private function get_currentScene() : Scene;
private function get_enabled() : Bool;
private function get_framesLoaded() : Int;
private function get_isPlaying() : Bool;
private function get_scenes() : Array<Scene>;
private function get_totalFrames() : Int;
private function get_trackAsMenu() : Bool;
function gotoAndPlay(frame : flash.utils.Object, ?scene : String) : Void;
function gotoAndStop(frame : flash.utils.Object, ?scene : String) : Void;
function nextFrame() : Void;
function nextScene() : Void;
function play() : Void;
function prevFrame() : Void;
function prevScene() : Void;
private function set_enabled(value : Bool) : Bool;
private function set_trackAsMenu(value : Bool) : Bool;
function stop() : Void;
}

View File

@ -0,0 +1,5 @@
package flash.display;
@:require(flash10_1) extern class NativeMenu extends flash.events.EventDispatcher {
function new() : Void;
}

View File

@ -0,0 +1,8 @@
package flash.display;
@:require(flash10_1) extern class NativeMenuItem extends flash.events.EventDispatcher {
@:flash.property var enabled(get,set) : Bool;
function new() : Void;
private function get_enabled() : Bool;
private function set_enabled(value : Bool) : Bool;
}

View File

@ -0,0 +1,5 @@
package flash.display;
extern class PNGCompressOptions implements IBitmapCompressOptions {
function new() : Void;
}

View File

@ -0,0 +1,6 @@
package flash.display;
extern final class PNGEncoderOptions {
var fastCompression : Bool;
function new(fastCompression : Bool = false) : Void;
}

View File

@ -0,0 +1,7 @@
package flash.display;
@:native("flash.display.PixelSnapping") extern enum abstract PixelSnapping(String) {
var ALWAYS;
var AUTO;
var NEVER;
}

View File

@ -0,0 +1,16 @@
package flash.display;
extern class SWFVersion {
static final FLASH1 : UInt;
static final FLASH10 : UInt;
static final FLASH11 : UInt;
static final FLASH12 : UInt;
static final FLASH2 : UInt;
static final FLASH3 : UInt;
static final FLASH4 : UInt;
static final FLASH5 : UInt;
static final FLASH6 : UInt;
static final FLASH7 : UInt;
static final FLASH8 : UInt;
static final FLASH9 : UInt;
}

View File

@ -0,0 +1,11 @@
package flash.display;
extern final class Scene {
@:flash.property var labels(get,never) : Array<FrameLabel>;
@:flash.property var name(get,never) : String;
@:flash.property var numFrames(get,never) : Int;
function new(name : String, labels : Array<FrameLabel>, numFrames : Int) : Void;
private function get_labels() : Array<FrameLabel>;
private function get_name() : String;
private function get_numFrames() : Int;
}

View File

@ -0,0 +1,13 @@
package flash.display;
@:require(flash10) extern class Shader {
@:flash.property var byteCode(never,set) : flash.utils.ByteArray;
@:flash.property var data(get,set) : ShaderData;
@:flash.property var precisionHint(get,set) : ShaderPrecision;
function new(?code : flash.utils.ByteArray) : Void;
private function get_data() : ShaderData;
private function get_precisionHint() : ShaderPrecision;
private function set_byteCode(value : flash.utils.ByteArray) : flash.utils.ByteArray;
private function set_data(value : ShaderData) : ShaderData;
private function set_precisionHint(value : ShaderPrecision) : ShaderPrecision;
}

View File

@ -0,0 +1,5 @@
package flash.display;
extern class ShaderData implements Dynamic {
function new(byteCode : flash.utils.ByteArray) : Void;
}

View File

@ -0,0 +1,18 @@
package flash.display;
extern final class ShaderInput implements Dynamic {
@:flash.property var channels(get,never) : Int;
@:flash.property var height(get,set) : Int;
@:flash.property var index(get,never) : Int;
@:flash.property var input(get,set) : Dynamic;
@:flash.property var width(get,set) : Int;
function new() : Void;
private function get_channels() : Int;
private function get_height() : Int;
private function get_index() : Int;
private function get_input() : Dynamic;
private function get_width() : Int;
private function set_height(value : Int) : Int;
private function set_input(value : Dynamic) : Dynamic;
private function set_width(value : Int) : Int;
}

View File

@ -0,0 +1,21 @@
package flash.display;
extern class ShaderJob extends flash.events.EventDispatcher {
@:flash.property var height(get,set) : Int;
@:flash.property var progress(get,never) : Float;
@:flash.property var shader(get,set) : Shader;
@:flash.property var target(get,set) : Dynamic;
@:flash.property var width(get,set) : Int;
function new(?shader : Shader, ?target : Dynamic, width : Int = 0, height : Int = 0) : Void;
function cancel() : Void;
private function get_height() : Int;
private function get_progress() : Float;
private function get_shader() : Shader;
private function get_target() : Dynamic;
private function get_width() : Int;
private function set_height(value : Int) : Int;
private function set_shader(value : Shader) : Shader;
private function set_target(value : Dynamic) : Dynamic;
private function set_width(value : Int) : Int;
function start(waitForCompletion : Bool = false) : Void;
}

View File

@ -0,0 +1,11 @@
package flash.display;
extern final class ShaderParameter implements Dynamic {
@:flash.property var index(get,never) : Int;
@:flash.property var type(get,never) : ShaderParameterType;
@:flash.property var value(get,set) : Array<Dynamic>;
private function get_index() : Int;
private function get_type() : ShaderParameterType;
private function get_value() : Array<Dynamic>;
private function set_value(value : Array<Dynamic>) : Array<Dynamic>;
}

Some files were not shown because too many files have changed in this diff Show More