Easy variable scope problem

i’m using a slide presentation document, and i have this code attached onto a slide:

on (load) {
var tmp = 5;
}
on (reveal) {
trace(tmp);
}

but when i run it, it traces ‘undefined’…
what am i missing here?