This all works fine but I can not trace(totalSlideNumber) or
make any reference to the variable totalSlideNumber. I keep on
getting "undefined". How can I reference the variable
totalSlideNumber to use it in the code.
totalSlideNumber is undefined until your onLoad method
executes. after that just reference it if you're on the same
timeline and use the correct path if you're referencing it from a
timeline other than the one that contains your above code.