Undefined variable

on level 0 : I have variable1=23;

by clicking on a button : loadmovie test.swf on level 1

once the test.swf loaded :

on level 1 another button with AS :

dir=level0:variable1

on (release) {
_level0.gotoAndStop(dir); // but this button don’t work
}

the error is in the AS of this button.

by typing the AS : _level0.gotoAndStop(23); everything is ok. The AS works.

So I made a trace(typeof(dir)) and the result is : undefined

who can I get this button to work ? do I have to transform the variable dir to a number ???

is there another possibility?

thanks for your help