Error 1067 with starling and adding event

63 views Asked by At

I'm trying to add in my code : dispatchEvent(new Event("someCustomTypeForEvent"));

But when I do, I've got an error 1067: Contrainte implicite d'une valeur du type flash.events:Event vers un type sans rapport starling.events:Event.

Do you know what could cause this ?

Here's my code :

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"));

                }
            }
        }
1

There are 1 answers

0
Astyan On

It seems that you use starling and that starling redefine Event. So your IDE might have not imported the right Event Object. If you have to use both these events, Try this:

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

Otherwise, check your import