# Click tag buttons and other mouse events

**URL:** https://forum.kirupa.com/t/click-tag-buttons-and-other-mouse-events/230504
**Category:** Uncategorized
**Created:** [June 26, 2007, 7:31pm UTC](https://forum.kirupa.com/t/click-tag-buttons-and-other-mouse-events/230504 "2007-06-26T19:31:53Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![somnamblst](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@somnamblst](https://forum.kirupa.com/u/somnamblst)
#### Post date: [June 26, 2007, 7:31pm UTC](https://forum.kirupa.com/t/click-tag-buttons-and-other-mouse-events/230504/1 "2007-06-26T19:31:53Z")

</div>

Banner ads have buttons that ad serving systems use the following syntax to dynamically assign a URL  
on (release) {  
if (\_root.clickTAG.substr(0,5) == “http:”) {  
getURL(\_root.clickTAG, “\_blank”);  
}

}

The clicktag button covers the stage (ad size) and prevents other mouse events like panning. Are there any hacks to get around this? I have a FLA that uses the following AS but the mandatory click tage button disables it the panning functionality.

```auto
import mx.utils.Delegate;
import flash.geom.Rectangle;
class com.McPan {
 private var __mc:MovieClip;
 private var __mcp:MovieClip;
 private var __ease:Number;
 private var __control:MovieClip;
 private var __yDiff:Number;
 private var __yRatio:Number;
 private var __yPos:Number;
 private var __xDiff:Number;
 private var __xRatio:Number;
 private var __xPos:Number;
 
 private var __imgW:Number;
 private var __imgH:Number; 
 private var __rect:Rectangle;
 
 private var __ptX:Number;
 private var __ptY:Number;
 
 private var __motionActive:Boolean = true;
 
 
 //new McPan(yourMovieClip, easing, clipX, clipY, aperature_width, aperature_height, initial_x_Offset, initial_y_Offset, cachImageOrNot);
 //---------------------------------------------------------------------------------
 //----------------------------------------- constructor
 //---------------------------------------------------------------------------------
 public function McPan(_mc:MovieClip, _ease:Number, _clipX:Number, _clipY:Number, _apertureW:Number, _apertureH:Number, _xoff:Number, _yoff:Number, _cache:Boolean) {
  // your clip to pan
  __mc = _mc;
  // amount of easing - .7 works well
  __ease = _ease;
  // store the clip's parent in a variable, it will be used for _xmouse, _ymouse
  __mcp =__ mc._parent;
  // get the initial width and height of the images
  __imgW =__ mc._width;
  __imgH =__ mc._height;
  // position the clip to x, y
  __mc._x = _clipX;
  __mc._y = _clipY;
  
  // turn on cache on/off based on passed parameter
  _cache!=undefined ? __mc.cacheAsBitmap = _cache :__ mc.cacheAsBitmap = false ;
  // I decided to run the onEnterframe within another clip vs. __mc
  // just incase __mc contained an animation or some other onEnterFrame events
  __control =__ mc.createEmptyMovieClip("controller", __mc.getNextHighestDepth());
  
  // create a new rectangle - position your clip to the offsets and aperature width / height
  
  __rect = new Rectangle(_xoff, _yoff, _apertureW, _apertureH);
  // set the clip's scrollRect
  __mc.scrollRect =__ rect;
  
  // button events to control movement start / stop
  __mc.onRollOver = Delegate.create(this,initiateMovement);
  __mc.useHandCursor = false;
 } 
 
 //---------------------------------------------------------------------------------
 //----------------------------------------- private methods
 //---------------------------------------------------------------------------------
 private function killMovement():Void {
  delete __control.onEnterFrame;
 }
 
 private function initiateMovement():Void {
  delete __mc.onRollOver;
  __control.onEnterFrame = Delegate.create(this,moveToMouse);
 }
 
 private function moveToMouse():Void {
  __mc.scrollRect = calcXY(__mcp._xmouse,__mcp._ymouse)[0];
  if(!__mc.hitTest(__mcp._xmouse, __mcp._ymouse, true)) {
   killMovement();
   if(__motionActive) {
    __mc.onRollOver = Delegate.create(this,initiateMovement);
   }
  }
 }
 
 private function moveToPoint():Void {
  var ar:Array = calcXY( __ptX,__ ptY);
  __mc.scrollRect = ar[0];
  if(Math.abs(ar[1]-ar[0].x)<1) {
   if(Math.abs(ar[2]-ar[0].y)<1) {
    delete __control.onEnterFrame;
   }
  }
 }
 
 private function calcXY(XP:Number,YP:Number):Array {
  // calculate the X offset / positions
  __xDiff = XP-__ mc._x;
  __xRatio =__ xDiff/__rect.width;
  __xPos =__ xRatio*( __imgW-__ rect.width);
  
  // calculate the Y offset / positions
  __yDiff = YP-__ mc._y;
  __yRatio =__ yDiff/__rect.height;
  __yPos =__ yRatio*( __imgH-__ rect.height);
  
  // set the rectangles offsets
  __rect.x =__ xPos-( __xPos-__ rect.x)*__ease;
  __rect.y =__ yPos-( __yPos-__ rect.y)*__ease;
  
  return [__rect,__ xPos, __yPos];
 }
 
 //---------------------------------------------------------------------------------
 //----------------------------------------- public methods
 //---------------------------------------------------------------------------------
 public function slideToPoint(x:Number,y:Number):Void {
  __ptX = x;
  __ptY = y;
  killMovement();
  __control.onEnterFrame = Delegate.create(this,moveToPoint);
 }
 
 public function stopMotion():Void {
  killMovement();
  __motionActive = false;
  delete __mc.onRollOver;
 }
 
 public function startMotion():Void {
  killMovement();
  __motionActive = true;
  __mc.onRollOver = Delegate.create(this,initiateMovement);
 }
}

```
