src/js/wrapper.js
Scoped.define("module:FlashObjectWrapper", [ "base:Class", "base:Objs", "base:Functions" ], function(Class, Objs, Functions, scoped) {
return Class.extend({
scoped : scoped
}, function(inherited) {
return {
constructor : function(embedding, objectIdent, objectType) {
inherited.constructor.call(this);
this.__embedding = embedding;
this.__ident = objectIdent;
this.__type = objectType;
if (embedding.__registry) {
var lookup = embedding.__registry.get(objectType);
if (lookup) {
Objs.iter(lookup.methods, function (method) {
this[method] = function () {
var args = Functions.getArguments(arguments);
args.unshift(method);
args.unshift(this.__ident);
return this.__embedding.flashCall.apply(this.__embedding, args);
};
this[method + "Void"] = function () {
var args = Functions.getArguments(arguments);
args.unshift(method);
args.unshift(this.__ident);
return this.__embedding.flashCallVoid.apply(this.__embedding, args);
};
}, this);
}
}
},
destroy: function () {
try {
this.__embedding.flashDestroy(this.__ident);
} catch (e) {}
inherited.destroy.call(this);
},
set: function (key, value) {
return this.__embedding.flashSet.call(this.__embedding, this.__ident, key, value);
},
get: function (key) {
return this.__embedding.flashGet.call(this.__embedding, this.__ident, key);
}
};
});
});
Scoped.define("module:FlashClassWrapper", [ "base:Class", "base:Objs", "base:Functions" ], function(Class, Objs, Functions, scoped) {
return Class.extend({
scoped : scoped
}, function(inherited) {
return {
constructor : function(embedding, classType) {
inherited.constructor.call(this);
this.__embedding = embedding;
this.__type = classType;
if (embedding.__registry) {
var lookup = embedding.__registry.get(classType);
if (lookup) {
Objs.iter(lookup.statics, function (method) {
this[method] = function () {
var args = Functions.getArguments(arguments);
args.unshift(method);
args.unshift(this.__type);
return this.__embedding.flashStaticCall.apply(this.__embedding, args);
};
this[method + "Void"] = function () {
var args = Functions.getArguments(arguments);
args.unshift(method);
args.unshift(this.__type);
return this.__embedding.flashStaticCallVoid.apply(this.__embedding, args);
};
}, this);
}
}
},
set: function (key, value) {
return this.__embedding.flashSetStatic.call(this.__embedding, this.__type, key, value);
},
get: function (key) {
return this.__embedding.flashGetStatic.call(this.__embedding, this.__type, key);
}
};
});
});