# Need a little help with this script!

**URL:** <https://forum.kirupa.com/t/need-a-little-help-with-this-script/238531>\
**Category:** flash\
**Created:** [September 12, 2007, 1:00pm UTC](https://forum.kirupa.com/t/need-a-little-help-with-this-script/238531 "2007-09-12T13:00:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Surekin](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@Surekin](https://forum.kirupa.com/u/Surekin)\
**Post date:** [September 12, 2007, 1:00pm UTC](https://forum.kirupa.com/t/need-a-little-help-with-this-script/238531/1 "2007-09-12T13:00:38Z")

</div>

Hey there, i need a little help with this transition script below!  
It’s a neat mask transition on mouse click!  
The Script works perfect as i want it to, BUT i need to resize the area where the user can click with the mouse to make the transition happen! Because the images are only the size of 200_266 but the whole stage has the size of 900_600! Now when i click anywhere on my stage the transition starts, but i only want it to start when the user clicks exactly on the image! Maybe someone of you pros can find where this is defined below!

thx in advance

```auto
Stage.scaleMode = 'noScale';
var speed = .2;
var delay = 2;
var switchblur = 9;
var images = ["hil", "ice", "mtn"];
var index = 0;
var transbmp = new flash.display.BitmapData(266,200);
var blurfilter = new flash.filters.BlurFilter();
loadTransBitmap(images[index]);
var clips = createGrid(this, 1, transbmp, 30);
function onMouseDown(){
 index++;
 index %= images.length;
 loadTransBitmap(images[index]);
 startTransition(clips, transbmp, speed, delay);
}
function loadTransBitmap(id){
 var tempbmp = flash.display.BitmapData.loadBitmap(id);
 transbmp.copyPixels(tempbmp, tempbmp.rectangle, new flash.geom.Point(0,0));
 tempbmp.dispose();
}
function createGrid(target, targdepth, sourcebmp, size){
 var home = target.createEmptyMovieClip("transition_mc", targdepth);
 var depth = 0;
 var clips = new Array();
 var row, rows = Math.ceil(sourcebmp.height/size);
 var col = Math.ceil(sourcebmp.width/size);
 var mc;
 var offset = new flash.geom.Point(0,0);
 while(col--){
  row = rows;
  clips[col] = new Array();
  while(row--){
   mc = home.createEmptyMovieClip("grid"+row+"_"+col, depth);
   mc.rect = new flash.geom.Rectangle(size*col, size*row, size, size);
   mc._x = mc.rect.left;
   mc._y = mc.rect.top;
   mc.rotate = 0;
   mc.speed = 0;
   mc.bitmap = new flash.display.BitmapData(mc.rect.width, mc.rect.height, true, 0);
   mc.bitmap.copyPixels(sourcebmp, mc.rect, offset);
   mc.attachBitmap(mc.bitmap, 1);
   mc.transition = null;
   clips[col][row] = mc;
   depth++;
  }
 }
 return clips;
}
function startTransition(clips, sourcebmp, speed, delay){
 var row, rows = clips[0].length;
 var col = clips.length;
 while(col--){
  row = rows;
  while(row--){
   clips[col][row].onEnterFrame = transOnEnterFrame;
   clips[col][row].transition = sourcebmp;
   clips[col][row].rotate = -(delay*(col+row)/2)/Math.PI;
   clips[col][row].speed = speed;
  }
 }
}
function transOnEnterFrame(){
 this.rotate += this.speed;
 
 if (this.rotate < 0) return;
 if (this.rotate > Math.PI){
  this.rotate = Math.PI;
  delete this.onEnterFrame;
 }
 
 if (this.transition && this.rotate >= (Math.PI/2)){
  this.bitmap.copyPixels(this.transition, this.rect, new flash.geom.Point(0,0));
  this.transition = null;
 }
 
 var sin = Math.sin(this.rotate);
 
 var matrix = new flash.geom.Matrix();
 matrix.tx = this.rect.left + sin*this.rect.width/2;
 matrix.ty = this.rect.top + sin*this.rect.height/2;
 matrix.b = matrix.c = -sin/2;
 matrix.a = matrix.d = 1 + matrix.b;
 this.transform.matrix = matrix;
 
 blurfilter.blurX = blurfilter.blurY = Math.floor(switchblur*sin);
 this.filters = [blurfilter];
}

```
