topical media & game development
professional-javascript-04-xbObjectsExample1.htm / htm
<html>
<head>
<title>Example</title>
<script type="text/javascript" src="xbObjects.js"></script>
</head>
<body>
<script type="text/javascript">
_classes.registerClass("ClassA");
function ClassA(sColor) {
_classes.defineClass("ClassA", prototypeFunction);
this.init(sColor);
function prototypeFunction() {
ClassA.prototype.init = function (sColor) {
this.parentMethod("init");
this.color = sColor;
};
ClassA.prototype.sayColor = function () {
alert(this.color);
};
}
}
var objA = new ClassA("red");
objA.sayColor(); //outputs "red"
</script>
</body>
</html>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.