Never mix AS2 (your leftarrow.onRelease, rightarrow.onRelease code) with AS3 (the email script)
The above code does the same as your code, but was written in AS2.
General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.