Add movieclip class

Hi,

I want to write a class that adds a movieclip to the stage, I need to pass the movieclip class to be added, a variable name, delay time, x position, y position, parent.

I would like to add it like this

addMyImage (mainImage, myMovieName, 2000, 20, 30, whiteBox);

I am having trouble with the syntax, I have put in square brackets where I want to use the parameters.

Thanks for any help,

AK.

function addMyImage(class, variableName, delay, xPos, yPos, myParent) {
var myTimer:Timer = new Timer(time);
myTimer.addEventListener(TimerEvent.TIMER, addIt);
myTimer.start();

function addIt(event:TimerEvent):void {

var [variableName]:MovieClip = new [classs]();

[myParent]. addChild([variableName];

}