# Error, ofcourse, 1009

**URL:** <https://forum.kirupa.com/t/error-ofcourse-1009/321566>\
**Category:** flash\
**Created:** [April 23, 2011, 6:29pm UTC](https://forum.kirupa.com/t/error-ofcourse-1009/321566 "2011-04-23T18:29:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lordmasta](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@lordmasta](https://forum.kirupa.com/u/lordmasta)\
**Post date:** [April 23, 2011, 6:29pm UTC](https://forum.kirupa.com/t/error-ofcourse-1009/321566/1 "2011-04-23T18:29:43Z")

</div>

i’ve been all over the web looking for a fix but somereason cannot fix it  
check it out

i am doing this with out oop, the first code is my main, the next is my Rose class.

```auto

import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;

var flowersInGame:uint; 
var flowerMaker:Timer;
var container_mc:MovieClip;

var cursor:MovieClip;

function initializeGame():void
{
	flowersInGame = 10;
	flowerMaker = new Timer(1000, flowersInGame);
	container_mc = new MovieClip();
	addChild(container_mc);
	
	flowerMaker.addEventListener(TimerEvent.TIMER, bloomFlower);
	flowerMaker.start();
	
	cursor = new Cursor();
	addChild(cursor);
	cursor.enabled = false;
	Mouse.hide(); 
	stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor);
	
}

function dragCursor(event:MouseEvent):void 
{
	cursor.x = this.mouseX;
	cursor.y = this.mouseY;
}

function bloomFlower(event:TimerEvent):void
{
	var flower:MovieClip;
	flower = new RoseBud();
	flower.x = Math.random() * stage.stageWidth;
	flower.y = Math.random() * stage.stageWidth;
	container_mc.addChild(flower);
}

initializeGame();

```

Now it says the error is at 1:22 and 1:12 of the rose class  
idk what it is exactly, or why its calling the object null  
i tried almost every fix i could find and the only thing thats worked, is as follows

Remove ENTER\_FRAME listener from code aswell as checkloaded,

but then when the mc gets to the end of its timeline it restarts, i want it to remove child,

thanks for all and any help

```auto
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.MovieClip;

this.addEventListener(MouseEvent.CLICK, cutRose);
this.addEventListener(Event.ENTER_FRAME,checkLoaded)

function checkLoaded(e:Event){
	if(this.enabled && this.currentFrame == 100){
	this.removeEventListener(Event.ENTER_FRAME,checkLoaded);

		removeRose();
	}
}

function removeRose():void
{
	this.removeEventListener(MouseEvent.CLICK, cutRose);
	this.parent.removeChild(this);
}

function cutRose(event:MouseEvent):void
{
	if (this.currentFrame > 34 && this.currentFrame < 85)
	{
		removeRose();
	}
}

```
