Help with flashVars in packages

I’m trying to modify a Flash file written with AS3 which sadly I’m not too familar with. I would like to pass variables to it. I can get it to work if I put this line of code in the main script area of the base .fla:

var myVar1:String = this.loaderInfo.parameters.menuID;

But I need to have this code inside a package that is in a separate .as file.

package menu{
import flash.display.;
import flash.events.
;
import flash.text.*;

public class MainMenu extends MovieClip {
          public function MainMenu()(
                 var myVar1:String = this.loaderInfo.parameters.menuID;
    }}}(code shortened for brevity)

When I try this I get the error: TypeError: Error #1009: Cannot access a property or method of a null object reference.

I kind of understand what the error means, but can’t find any solution to fix it. Can anybody help?

Thanks.