swapDepths tutorial code not working

i did the tutorial

http://www.kirupa.com/developer/actionscript/swapdepth.htm

on this site, but no joy…

only relevant code i can see in demo file is:

on (press, release, dragOver, dragOut) {
_root.x += 2;
_root.green.swapDepths(_root.x);
}

which i adapted to:

on (press) {
_root.x += 7;
_root.pic7mov.swapDepths(_root.x);
}

where pic7mov is an mc on the main timeline with a invButton on top layer with the code in it.

where is the code for the function x (which the tutorial says “resides on the main timeline”)… surely without it the code doesnt work… like javaScript it should relate to a function n’est pas?? i couldnt find it on example but example works ??