# Error #2007: Parameter listener must be non-null

**URL:** <https://forum.kirupa.com/t/error-2007-parameter-listener-must-be-non-null/328267>\
**Category:** Uncategorized\
**Created:** [May 2, 2012, 7:50am UTC](https://forum.kirupa.com/t/error-2007-parameter-listener-must-be-non-null/328267 "2012-05-02T07:50:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olivia\_Chapman1](https://avatars.discourse-cdn.com/v4/letter/o/d2c977/32.png) [@Olivia\_Chapman1](https://forum.kirupa.com/u/Olivia_Chapman1)\
**Post date:** [May 2, 2012, 7:50am UTC](https://forum.kirupa.com/t/error-2007-parameter-listener-must-be-non-null/328267/1 "2012-05-02T07:50:03Z")

</div>

Hi I’m creating a winnie the pooh colouring in game and I’m getting  
TypeError: Error #2007: Parameter listener must be non-null.  
at flash.events::EventDispatcher/addEventListener()  
at ColouringinGame\_fla::MainTimeline/frame1()

The Code on the main time line is

import flash.events.MouseEvent;

var myColor = 0xFFFFFF;

function getBlack(event:MouseEvent):void {  
myColor = 0x000000;  
}  
function getLightBlue(event:MouseEvent):void {  
myColor = 0x33CCFF;  
}  
function getDarkBlue(event:MouseEvent):void {  
myColor = 0x3300CC;  
}  
function getGrey(event:MouseEvent):void {  
myColor = 0x666666;  
}  
function getLightGreen(event:MouseEvent):void {  
myColor = 0x66CC66;  
}  
function getDarkGreen(event:MouseEvent):void {  
myColor = 0x003300;  
}  
function getBrown(event:MouseEvent):void {  
myColor = 0x663300;  
}  
function getOrange(event:MouseEvent):void {  
myColor = 0xFF9900;  
}  
function getPink(event:MouseEvent):void {  
myColor = 0xFF66FF;  
}  
function getSkin(event:MouseEvent):void {  
myColor = 0xFFCCCC;  
}  
function getPurple(event:MouseEvent):void {  
myColor = 0x6600CC;  
}  
function getRed(event:MouseEvent):void {  
myColor = 0xFF0000;  
}  
function getWhite(event:MouseEvent):void {  
myColor = 0xFFFFFF;  
}  
function getYellow(event:MouseEvent):void {  
myColor = 0xFFFF00;  
}

this.b\_black.addEventListener(MouseEvent.MOUSE\_DOWN, getBlack);  
this.b\_grey.addEventListener(MouseEvent.MOUSE\_DOWN, getGrey);  
this.b\_dgreen.addEventListener(MouseEvent.MOUSE\_DOWN, getDarkGreen);  
this.b\_lblue.addEventListener(MouseEvent.MOUSE\_DOWN, getLightBlue);  
this.b\_dblue.addEventListener(MouseEvent.MOUSE\_DOWN, getDarkBlue);  
this.b\_lgreen.addEventListener(MouseEvent.MOUSE\_DOWN, getLightGreen);  
this.b\_brown.addEventListener(MouseEvent.MOUSE\_DOWN, getBrown);  
this.b\_orange.addEventListener(MouseEvent.MOUSE\_DOWN, getOrange);  
this.b\_pink.addEventListener(MouseEvent.MOUSE\_DOWN, getPink);  
this.b\_purple.addEventListener(MouseEvent.MOUSE\_DOWN, getPurple);  
this.b\_red.addEventListener(MouseEvent.MOUSE\_DOWN, getRed);  
this.b\_white.addEventListener(MouseEvent.MOUSE\_DOWN, getWhite);  
this.b\_yellow.addEventListener(MouseEvent.MOUSE\_DOWN, getYellow);  
this.b\_skin.addEventListener(MouseEvent.MOUSE\_DOWN, getSkin);

this.b\_black.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_grey.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_dgreen.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_lblue.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_dblue.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_lgreen.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_brown.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_orange.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_pink.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_purple.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_red.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_white.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_yellow.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);  
this.b\_skin.addEventListener(MouseEvent.MOUSE\_UP, this.brush.colorMe);

this.Pooh.P\_legs.addEventListener(MouseEvent.MOUSE\_UP, this.Pooh.P\_legs.colorMe);  
this.Pooh.P\_arms.addEventListener(MouseEvent.MOUSE\_UP, this.Pooh.P\_arms.colorMe);  
this.Pooh.P\_shirt.addEventListener(MouseEvent.MOUSE\_UP, this.Pooh.P\_shirt.colorMe);  
this.Pooh.P\_body.addEventListener(MouseEvent.MOUSE\_UP, this.Pooh.P\_body.colorMe);  
this.Pooh.P\_head.addEventListener(MouseEvent.MOUSE\_UP, this.Pooh.P\_head.colorMe);  
this.Pooh.P\_tounge.addEventListener(MouseEvent.MOUSE\_UP, this.Pooh.P\_tounge.colorMe);  
this.Pooh.P\_Tjar.addEventListener(MouseEvent.MOUSE\_UP, this.Pooh.P\_Tjar.colorMe);  
this.Pooh.P\_bjar.addEventListener(MouseEvent.MOUSE\_UP, this.Pooh.P\_bjar.colorMe);

function moveBrush (event:Event) : void {  
this.brush.startDrag (true);  
Mouse.hide();  
}

this.addEventListener(Event.ENTER\_FRAME, moveBrush);

And the code on the brush is

function paint(obj:Object,myColor:Number):void {  
var newColor:ColorTransform = new ColorTransform();  
newColor.color = myColor;  
obj.transform.colorTransform = newColor;  
}

function colorMe(event:MouseEvent):void {  
this.paint(this.tip, event.target.root.myColor);  
}

```
mouseEnabled = false;
```
