0

So I'm developing a sorting game for a game jam, and my AS3 skills are still a bit unrefined.

I have an InputManager.as that determines whether the device is touch-capable or not, and then in the classes that need it, grabbing that info.

Problem I'm having is:

C:\GameDev\Progressive Bytes\Dan\Scripts\Screens\Buttons.as, Line 55 1067: Implicit coercion of a value of type String to an unrelated type Function.

Here's where the problem is:

        if(InputManager.isTouch){
            this.addEventListener(TouchEvent.TOUCH_BEGIN, TouchEventHandler);
        } else {
            this.addEventListener(MouseEvent.MOUSE_OVER, over);
        }

This is in the Button's constructor.

I've done a bit of searching around, but I can't seem to find any answers about a 1067 on an event listener that are relevant to this problem. But, as I said, kind of a noob with AS3.

Thanks!!

4

1 回答 1

0

这是有错误的行:

this.addEventListener(TouchEvent.TOUCH_BEGIN, TouchEventHandler);

您必须了解第一个参数是一个带有事件名称的字符串,第二个参数必须是一个函数并且您传递一个类引用。

我假设第 4 行中的over参数是一个函数,并且对你来说很好。另外我假设TouchEvent.TOUCH_BEGIN属性是一个字符串。

于 2013-05-05T16:25:59.927 回答