# Error - i dont understand

**URL:** https://forum.kirupa.com/t/error-i-dont-understand/300251
**Category:** Uncategorized
**Created:** [November 18, 2009, 7:46am UTC](https://forum.kirupa.com/t/error-i-dont-understand/300251 "2009-11-18T07:46:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![n000bie](https://avatars.discourse-cdn.com/v4/letter/n/7993a0/32.png) [@n000bie](https://forum.kirupa.com/u/n000bie)
#### Post date: [November 18, 2009, 7:46am UTC](https://forum.kirupa.com/t/error-i-dont-understand/300251/1 "2009-11-18T07:46:06Z")

</div>

1067: Implicit coercion of a value of type GameOverScreen to an unrelated type Class.  
1188: Illegal assignment to class GameOverScreen.

in DocumentClass.as line 22

this is my code

```auto
package 
{
    import flash.display.MovieClip;
    
    public class DocumentClass extends MovieClip
    {
        public var playScreen:Game;
        public var gameOverScreen:GameOverScreen;
        
        public function DocumentClass()
        {
            playScreen = new Game;
            playScreen.addEventListener(AvatarEvent.DEAD, onAvatarDeath);
            playScreen.x = 0;
            playScreen.y = 0;
            
            addChild(playScreen);
        }
        
        public function onAvatarDeath(avatarEvent:AvatarEvent):void
        {
            gameOverScreen:GameOverScreen = new GameOverScreen(); // this is line 22
            gameOverScreen.x = 0;
            gameOverScreen.y = 0;
            addChild(gameOverScreen);
            
            playScreen = null;
        }
        
        public function restartGame():void 
        {
            playScreen = new Game;
            playScreen.addEventListener(AvatarEvent.DEAD, onAvatarDeath);
            playScreen.x = 0;
            playScreen.y = 0;
            addChild(playScreen);
            
            gameOverScreen = null;
        }
    }
}

```

If i keep the word var on line 22 it works  
var gameOverScreen:GameOverScreen = new GameOverScreen();

When i remove it it shows the above error.

I have defined it above  
public var gameOverScreen:GameOverScreen;

Why it needs to be defined twice ? I don’t understand.
