# Stopping a tween by clicking a movieclip

**URL:** <https://forum.kirupa.com/t/stopping-a-tween-by-clicking-a-movieclip/275717>\
**Category:** Uncategorized\
**Created:** [November 17, 2008, 9:34pm UTC](https://forum.kirupa.com/t/stopping-a-tween-by-clicking-a-movieclip/275717 "2008-11-17T21:34:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluehat79](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@bluehat79](https://forum.kirupa.com/u/bluehat79)\
**Post date:** [November 17, 2008, 9:34pm UTC](https://forum.kirupa.com/t/stopping-a-tween-by-clicking-a-movieclip/275717/1 "2008-11-17T21:34:24Z")

</div>

Hello all!

I’m trying to build a game that’s a dunking booth. With two balls that yoyo until each is clicked, at which point they should stop and then using the positions of the two balls the actual ball is thrown at the target.

I’m so far away from that it’s obscene.

Here’s my code:

```auto

package {
 import fl.transitions.Tween;
 import fl.transitions.TweenEvent;
 import fl.transitions.easing.*;
 import flash.display.MovieClip;
 import flash.text.TextField;
 import flash.events.Event;
 import flash.events.MouseEvent;
 public class dunking_booth extends MovieClip {
  private var score:int;
  public function dunking_booth() {
   var horTween:Tween = new Tween(horball,"x",Regular.easeInOut,203,325,2,true);
   var verTween:Tween = new Tween(verball,"y",Regular.easeInOut,43,229,2,true);
   horTween.addEventListener(TweenEvent.MOTION_FINISH,horback);
   verTween.addEventListener(TweenEvent.MOTION_FINISH,verback);
   verball.addEventListener(MouseEvent.CLICK,verclicked);
   horball.addEventListener(MouseEvent.CLICK,horclicked);
   score = 0;
  }
  public function horback(event:TweenEvent):void {
   //trace("Hor rewind fired");
   //trace(event.currentTarget);
   var horRew:Tween = (event.currentTarget as Tween);
   horRew.yoyo();
  }
  public function verback(event:TweenEvent):void {
   //trace("Ver rewind fired");   
   //trace(event.currentTarget);
   var verRew:Tween = (event.currentTarget as Tween);   
   verRew.yoyo();
  }
  public function verclicked(evt:MouseEvent):void {
   trace("Mouse Clicked on Vertical");
   trace (evt.target.name);
  // Here is where I planned on stopping the tween that is moving the ball movieclip
  }
  public function horclicked(evt:MouseEvent) {
   trace("Mouse Clicked on Horizontal");
  // Here as well.
  }
 }
}
 

```

I imagine I’m doing a bunch of things redundantly, if anybody can point me in the right direction I’d deeply appreciate it.

Thanks.
