# Class help wished

**URL:** <https://forum.kirupa.com/t/class-help-wished/318674>\
**Category:** Uncategorized\
**Created:** [January 27, 2011, 12:30am UTC](https://forum.kirupa.com/t/class-help-wished/318674 "2011-01-27T00:30:09Z")\
**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:** [January 27, 2011, 12:30am UTC](https://forum.kirupa.com/t/class-help-wished/318674/1 "2011-01-27T00:30:09Z")

</div>

Greetings mortals!

For a project i am needed to move a vast range of movieclips over time on the stage.  
I thought to write a class to tackle it. my little class experience tells me you can’t acces the stage in the constructor. well great, just add an eventlistener for the ADDED\_TO\_STAGE…  
great, but still … I wonder how to pass the stage.stageWidth to a custom class as an optional parameter. lol now that i am writting it… does it even make sense…

here we go…

I’d love to have the stageWidth as an optional argument  
var test = myClass(“0xff0033”,“my text”, stage.stageWidth);  
yet it reports the argument can’t be null…

I have my construction as such:

public function myClass(\_color:String,\_txt:String,\_newWidth:Number=null){  
//bake pancakes  
}  
I learned a number can’t be null as like an Int  
setting it as \_newWidth:Number = 0 doesn’t help much either.

Many thanks for a good pointer.  
I did some searches but a) my google skills are bad b) i am looking over it.

Thanks , best regards
