# Class + parameter returns null

**URL:** <https://forum.kirupa.com/t/class-parameter-returns-null/319055>\
**Category:** Uncategorized\
**Created:** [February 7, 2011, 9:16pm UTC](https://forum.kirupa.com/t/class-parameter-returns-null/319055 "2011-02-07T21:16:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tristessa](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@tristessa](https://forum.kirupa.com/u/tristessa)\
**Post date:** [February 7, 2011, 9:16pm UTC](https://forum.kirupa.com/t/class-parameter-returns-null/319055/1 "2011-02-07T21:16:05Z")

</div>

Greetings

i’ve written a little button util for a project i am working on.  
The problem is that i pass through a variable that first is null, but direct after that it recognizes the correct one.

At first i thought it was due to the fact i want this variable to be optional.  
but even without all this, it doesn’t work correctly.

Any way to solve this? … many thanks

its constructor is very simple:

```auto

var cc:itemList_CMS = new itemList_CMS ("FOLDER");

```

the portion of the class

```auto

public function itemList_CMS (typeList:String=null):void
{
  trace ("type = " + typeList);
//returns first null, then the correct 
addEventListener(Event.ADDED_TO_STAGE, onAdded);
}
private function onAdded(e:Event):void 
{
	removeEventListener(Event.ADDED_TO_STAGE, onAdded);
	 trace ("type = " + typeList)
//does the same, first traces out null, then the correct one.
}

```
