# Importing mouse event class

**URL:** <https://forum.kirupa.com/t/importing-mouse-event-class/302868>\
**Category:** Uncategorized\
**Created:** [January 8, 2010, 11:22pm UTC](https://forum.kirupa.com/t/importing-mouse-event-class/302868 "2010-01-08T23:22:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MadFLeX](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@MadFLeX](https://forum.kirupa.com/u/MadFLeX)\
**Post date:** [January 8, 2010, 11:22pm UTC](https://forum.kirupa.com/t/importing-mouse-event-class/302868/1 "2010-01-08T23:22:20Z")

</div>

Hey guys. First post.=)

I’m new to AS3 and I’m working on a game that I’ve run into a problem with.

I converted a movie on my main timeline to a movie clip and suddenly my event listeners weren’t working right. I kinda figured I needed to import the mouse event class to make it work, but it didn’t help.

I have 5 AS keyframes that act on a single button (submit\_btn) along the mc timeline. This is the code assigned to each keyframe

import flash.events.MouseEvent;  
swing\_btn.addEventListener(MouseEvent.CLICK,press1);  
function press1(evt:MouseEvent):void { MovieClip(root).gotoAndStop(1,“HitsBrianMFSEmerald”); }

It’s a baseball game. The idea is… depending on how early or late you swing, the ball goes different places. There are 3 swing keyframes that span 30 total keyframes. So there are 30 frames where you should ALWAYS get a hit. But for some reason, the majority of the time I click during the 30 frames and, NOTHING happens. Sometimes it works. That’s why it’s confusing.

Suggestions? Thanks!
