# AS2 to AS3 conversion (PAID)

**URL:** <https://forum.kirupa.com/t/as2-to-as3-conversion-paid/295158>\
**Category:** flash\
**Created:** [August 26, 2009, 4:26am UTC](https://forum.kirupa.com/t/as2-to-as3-conversion-paid/295158 "2009-08-26T04:26:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgekhowell](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@georgekhowell](https://forum.kirupa.com/u/georgekhowell)\
**Post date:** [August 26, 2009, 4:26am UTC](https://forum.kirupa.com/t/as2-to-as3-conversion-paid/295158/1 "2009-08-26T04:26:15Z")

</div>

hello out there. I’m a new member/not experienced in ActionScript (Graphic Designer norm). I need the following code converted from AS2 to AS3 for a Flex job I’m working on. I’ll negotiate with the client as to “how much” this will cost, so anyone out there willing, please pass me on a price (PayPal):

Here’s the code:

Stage.scaleMode = ‘noScale’;  
var speed = 20;  
var rate = 5;  
var focallength = 250;  
var maxheight = 100;  
var origin = new flash.geom.Point(150, 300);  
var images = [“corp1”, “events1”, “launch1”, “wed1”, “home1”,];  
var blurfilter = new flash.filters.BlurFilter(0,0,1);  
var shadowfilter = new flash.filters.DropShadowFilter(0,45,0x0, .20, 0,0, 1, 1, false,false,false);  
var raisedepth = 0;  
var imagesindex = 0;  
var basepoint = new flash.geom.Point(0,0);  
var transbmp = new flash.display.BitmapData(300,300);  
var transclips;  
click\_mc.swapDepths(2);  
loadTransBitmap( images[imagesindex] );  
var clips = createGrid(this, 1, transbmp, 10, 10);

function onMouseDown():void{  
loadTransBitmap( getNextImage() );  
startTransition(clips, transbmp, speed, delay);  
}  
function getNextImage():void{  
imagesindex++;  
imagesindex %= images.length;  
return images[imagesindex];  
}  
function loadTransBitmap(id):void{  
var tempbmp = flash.display.BitmapData.loadBitmap(id);  
transbmp.copyPixels(tempbmp, tempbmp.rectangle, basepoint);  
tempbmp.dispose();  
}  
function createGrid(target, targdepth, sourcebmp, cols, rows):void{  
target.createEmptyMovieClip(“transition\_mc”, targdepth);  
target.transition\_mc.createEmptyMovieClip(“reveal\_mc”, 0);  
var grid = target.transition\_mc.createEmptyMovieClip(“grid\_mc”, 1);  
var col, row;  
var refRect = new flash.geom.Rectangle(0,0,0,0);  
var clips = new Array();  
clips.reveal = target.transition\_mc.reveal\_mc;  
clips.reveal.bitmap = sourcebmp.clone();  
clips.reveal.attachBitmap(clips.reveal.bitmap, 1);  
var mc;  
var depth = 0;

for (col = 0; col \< cols; col++){  
refRect.top = 0;  
refRect.left = refRect.right;

for (row = 0; row \< rows; row++){  
refRect.right = Math.round(sourcebmp.width \* (col+1)/cols);  
refRect.bottom = Math.round(sourcebmp.height \* (row+1)/rows);

mc = grid.createEmptyMovieClip(“grid”+row+"\_"+col, depth);  
mc.depth = depth;  
mc.rect = refRect.clone();  
mc.\_x = mc.rect.left;  
mc.\_y = mc.rect.top;  
mc.x = mc.rect.left;  
mc.y = mc.rect.top;  
mc.elevation = 0;

mc.bitmap = new flash.display.BitmapData(mc.rect.width, mc.rect.height, true, 0);  
mc.bitmap.copyPixels(sourcebmp, mc.rect, basepoint);  
mc.attachBitmap(mc.bitmap, 1);

clips.push(mc);  
depth++;

refRect.top = refRect.bottom;  
}  
}  
return clips;  
}  
function startTransition(clips, transbmp, speed, delay):void{  
transclips = clips.slice();  
raisedepth = 2\*transclips.length;  
clips.reveal.bitmap.draw(transbmp);  
onEnterFrame = transOnEnterFrame;  
}  
function transOnEnterFrame():void{  
var i = rate;  
var rand, clip;  
while(i–) {  
rand = Math.floor(Math.random()\*transclips.length);  
clip = transclips.splice(rand,1)[0];  
clip.onEnterFrame = transClipOnEnterFrame;  
clip.swapDepths(raisedepth);  
raisedepth–;  
if (!transclips.length){  
break;  
delete this.onEnterFrame;  
}  
}  
}  
function transClipOnEnterFrame():void{  
this.elevation += speed;  
if (this.elevation \> maxheight){  
resetClip(this);  
delete this.onEnterFrame;  
}else{  
renderClip(this);  
}  
}  
function resetClip(mc):void{  
mc.elevation = 0;  
mc.x = mc.rect.left;  
mc.y = mc.rect.top;  
mc.bitmap.copyPixels(clips.reveal.bitmap, mc.rect, basepoint);  
mc.swapDepths(mc.depth);  
renderClip(mc);  
}  
function renderClip(mc):void{  
var scaleratio = focallength/(focallength - mc.elevation);

mc.\_x = origin.x + (mc.x - origin.x)_scaleratio;  
mc.\_y = origin.y + (mc.y - origin.y)scaleratio;  
mc.\_xscale = 100scaleratio;  
mc.\_yscale = 100_scaleratio;

blurfilter.blurX = blurfilter.blurY = Math.floor(mc.elevation/10);  
shadowfilter.distance = mc.elevation;  
mc.filters = [shadowfilter, blurfilter];  
}

any questions: [georgekhowell@hotmail.com](mailto:georgekhowell@hotmail.com)
