【问题标题】:Error 1067 with starling and adding event八哥和添加事件的错误 1067
【发布时间】:2014-11-19 06:54:50
【问题描述】:

我正在尝试添加我的代码: dispatchEvent(new Event("someCustomTypeForEvent"));

但是当我这样做时,我得到了一个错误 1067: Contrainte implicite d'une valeur du type flash.events:Event vers un type sans rapport starling.events:Event.

你知道是什么原因造成的吗?

这是我的代码:

private function die():void
        {
            if (!gameOver)
            {
                gameOver = true;
                assets.playSound("smack");
                ce.stage.removeEventListener(MouseEvent.MOUSE_DOWN, fly);
                // prevent clicking briefly to let the player see their score
                var t:Timer = new Timer(500, 1);
                t.addEventListener(TimerEvent.TIMER_COMPLETE, cont);
                t.start();
                function cont(e:TimerEvent):void
                {
                    textField.text = "Score: " + score;
                    scoreText.text = "";
                    eaze(box).to(0.4, { y: 150 } );
                    eaze(textField).to(0.4, { y: 150 } );
                    ce.stage.addEventListener(MouseEvent.MOUSE_DOWN, startOver);
                    cont1();
                }
                function cont1():void
                {
dispatchEvent(new Event("someCustomTypeForEvent"));

                }
            }
        }

【问题讨论】:

    标签: actionscript-3 starling-framework


    【解决方案1】:

    您似乎使用了starling,而starling 重新定义了Event。 所以你的 IDE 可能没有导入正确的事件对象。如果你必须同时使用这两个事件,试试这个:

    dispatchEvent(new flash.event.Event("someCustomTypeForEvent"));
    

    否则,请检查您的导入

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多