0

Container を拡張するカスタム クラスを作成しました。ただし、リスナーを追加しようとすると、次のエラーが発生します。

「TypeError: this.addEventListener は関数ではありません

これが私のコードの最小限の例です:

(function() {
    var ExtendedContainerObject = function() {
        this.initialize();
    }

    // inherit from Container
    var p = ExtendedContainerObject.prototype = new createjs.Container();

    p.Container_initialize = p.initialize;
    p.initialize = function() {
        this.Container_initialize();
        console.log("this: " + this);
        this.addEventListener("custom_event", function(evt){console.log("this: " + evt.target);});

        this.button.onPress = function(evt) {
            evt.onMouseMove = function(ev) {
                dispatchEvent(new Event("custom_event", this));
            }
        }
    }

    window.ExtendedContainerObject = ExtendedContainerObject;
}());
4

1 に答える 1

1

これをまったく同じように使用するクラスがあります。動作するはずです。EaselJS0.6.0を使用していますか?

于 2013-02-28T22:36:28.587 に答える