# TypeError: #1007

**URL:** <https://forum.kirupa.com/t/typeerror-1007/315793>\
**Category:** flash\
**Created:** [November 4, 2010, 7:39am UTC](https://forum.kirupa.com/t/typeerror-1007/315793 "2010-11-04T07:39:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WEich1213](https://avatars.discourse-cdn.com/v4/letter/w/ecb155/32.png) [@WEich1213](https://forum.kirupa.com/u/WEich1213)\
**Post date:** [November 4, 2010, 7:39am UTC](https://forum.kirupa.com/t/typeerror-1007/315793/1 "2010-11-04T07:39:59Z")

</div>

Hello, could someone tell me what this error means? And how I could fix it, if possible, Thanks a lot

TypeError: Error #1007: Instantiation attempted on a non-constructor.  
at Foreground()  
at Lunar\_Madness()

Here’s the classes I’m working with:

package {  
import flash.display.MovieClip;  
import flash.events.Event;  
import flash.display.DisplayObject;  
import flash.display.Shape;  
import flash.display.Bitmap;  
import flash.display.BitmapData;

```
public class Foreground extends MovieClip
{
	private var _foregroundBitmap:Bitmap;
	private var _foregroundBitmapData:BitmapData;
	
	[Embed(source="bg.png")]
	private var ForegroundImage:Class;
	
	
	
	
	public function Foreground()
	{
		
	
	
		var _foregroundImage:DisplayObject = new ForegroundImage();
		
		_foregroundBitmapData = new BitmapData(_foregroundImage.width, _foregroundImage.height, true, 0);
		_foregroundBitmapData.draw(_foregroundImage);
		
		_foregroundImage = new Bitmap(_foregroundBitmapData);
		addChild(_foregroundBitmap);
		_foregroundBitmap.x = -26;
		_foregroundBitmap.y = 116;
		
		addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
	}
	private function onAddedToStage(event:Event):void
	{ 
	
		//Initialize properties
		//Add event listenters
		addEventListener(Event.ENTER_FRAME, onEnterFrame);
		addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
	}
	private function onRemovedFromStage(event:Event):void
	{
		removeEventListener(Event.ENTER_FRAME, onEnterFrame);
		removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
		removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage)
	}
	private function onEnterFrame(event:Event):void
	{//Directives....
	}
}

```

}

package {  
import flash.display.MovieClip;  
import flash.events.Event;

```
public class Lunar_Madness extends MovieClip
{
	
	private var _playerShip:PlayerShip;
	private var _playerMissiles:PlayerMissiles;
	private var _foreground:Foreground;
	
	public function Lunar_Madness()
	{
		
		
		_playerShip = new PlayerShip();
		_playerMissiles = new PlayerMissiles();
		_foreground = new Foreground();
		
		addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
	}
	private function onAddedToStage(event:Event):void
	{ 
	
		//Initialize properties
		
		
		
		addChild(_playerShip);
		addChild(_playerMissiles);
		addChild(_foreground);
		//Add event listenters
		
		addEventListener(Event.ENTER_FRAME, onEnterFrame);
		addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
	}
	private function onRemovedFromStage(event:Event):void
	{
		removeEventListener(Event.ENTER_FRAME, onEnterFrame);
		removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
		removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage)
	}
	private function onEnterFrame(event:Event):void
	{//Directives....
		
		_playerShip.frameEvents();
		_playerMissiles.frameEvents();
	}
	
	
	
	
}

```

}

Thanks a lot for any help.
