Function in function?

I’m trying to make a function:


function test (mc:String, pixel:Number){
with (mc){
onEnterFrame = function(){
 _x += pixel;
}
}

Problem:
The variables won’t be recognized anymore after the second function.

How can I get this code working?