# Actionscript 1.0 to Actionscript 2.0 conversion, Help!

**URL:** <https://forum.kirupa.com/t/actionscript-1-0-to-actionscript-2-0-conversion-help/231957>\
**Category:** flash\
**Created:** [July 9, 2007, 11:20pm UTC](https://forum.kirupa.com/t/actionscript-1-0-to-actionscript-2-0-conversion-help/231957 "2007-07-09T23:20:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![s0me0ne](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@s0me0ne](https://forum.kirupa.com/u/s0me0ne)\
**Post date:** [July 9, 2007, 11:20pm UTC](https://forum.kirupa.com/t/actionscript-1-0-to-actionscript-2-0-conversion-help/231957/1 "2007-07-09T23:20:52Z")

</div>

## Hi guys, Straight to the point. I found this skewing prototype in laco tweener web. And it was in actionscript 1.0 can u convert this code so its compatible with flash8 & actionscript 2.0 please? I can’t seem to know what’s wrong in here that I cant play it in as2.

var mp = MovieClip.prototype;  
mp.setXskew = function(value) {  
var \_xskew = value;  
//this.\_xskew = value;  
//  
var \_yskew = this.\_yskew;  
// add properties to movieclip  
if (!this.inner\_mc) {  
// defines inner\_mc clip needed to skew  
for (var clips in this) {  
if (typeof (this[clips]) == “movieclip”) {  
this.inner\_mc = this[clips];  
// finds first movieclip and uses it to skew  
break;  
}  
}  
if (!this.inner\_mc) {  
return trace(“No interior clip for skewing found in “+this.\_name+”.”);  
// error if inner not found  
} else {  
this.inner\_mc.\_rotation = -45;  
}  
// assure clip is rotated -45 degrees  
}  
var toRads = Math.PI/180;  
// converts degrees to radians  
var xr = \_xskew_toRads;  
// skew in radians  
var yr = \_yskew_toRads;  
var cosxr = Math.cos(xr);  
// cosine of skew  
var cosyr = Math.cos(yr);  
this.\_rotation = 45+(\_xskew+\_yskew)/2;  
// rotate this clip accordingly  
var div = Math.sin(this.\_rotation_toRads)_.707106781186547;  
//div: divisor - sin rotation _sin 45 degrees;  
if (!div) {  
div = .0000001;  
}  
// prevents dividing by 0 which you just… cant… do  
this.\_xscale = 100_(Math.sin(yr)+cosxr)/div;  
// scaling for skew  
this.\_yscale = 100\*(Math.sin(xr)+cosyr)/div;  
this.inner\_mc.\_yscale = this.inner\_mc.\_xscale=50/cosyr;  
// scaling inner to maintain width/height  
// = base\_yscale\*.5/cosxr;  
};  
ASSetPropFlags(mp, “setXskew”, 1, 0);  
//  
mp.getXskew = function() {  
return this.\_xskew;  
};  
ASSetPropFlags(mp, “getXskew”, 1, 0);  
//  
mp.setYskew = function(value) {  
var \_xskew = this.\_xskew;  
//  
var \_yskew = value;  
//this.\_yskew = value;  
// add properties to movieclip  
if (!this.inner\_mc) {  
// defines inner\_mc clip needed to skew  
for (var clips in this) {  
if (typeof (this[clips]) == “movieclip”) {  
this.inner\_mc = this[clips];  
// finds first movieclip and uses it to skew  
break;  
}  
}  
if (!this.inner\_mc) {  
return trace(“No interior clip for skewing found in “+this.\_name+”.”);  
// error if inner not found  
} else {  
this.inner\_mc.\_rotation = -45;  
}  
// assure clip is rotated -45 degrees  
}  
var toRads = Math.PI/180;  
// converts degrees to radians  
var xr = \_xskew_toRads;  
// skew in radians  
var yr = \_yskew_toRads;  
var cosxr = Math.cos(xr);  
// cosine of skew  
var cosyr = Math.cos(yr);  
this.\_rotation = 45+(\_xskew+\_yskew)/2;  
// rotate this clip accordingly  
var div = Math.sin(this.\_rotation_toRads)_.707106781186547;  
//div: divisor - sin rotation _sin 45 degrees;  
if (!div) {  
div = .0000001;  
}  
// prevents dividing by 0 which you just… cant… do  
this.\_xscale = 100_(Math.sin(yr)+cosxr)/div;  
// scaling for skew  
this.\_yscale = 100\*(Math.sin(xr)+cosyr)/div;  
this.inner\_mc.\_yscale = this.inner\_mc.\_xscale=50/cosxr;  
// scaling inner to maintain width/height  
//  
};  
ASSetPropFlags(mp, “setYskew”, 1, 0);  
//  
mp.getYskew = function() {  
return this.\_yskew;  
};  
ASSetPropFlags(mp, “getYskew”, 1, 0);  
//  
mp.addProperty("\_xskew", mp.getXskew, mp.setXskew);  
ASSetPropFlags(mp, “\_xskew”, 1, 0);  
mp.addProperty("\_yskew", mp.getYskew, mp.setYskew);  
ASSetPropFlags(mp, “\_yskew”, 1, 0);  
delete mp;

* * *

and here’s the code for the press button.  
#include “lmc\_tween.as”  
//  
skew\_btn.onPress = function() {  
squares\_mc\_xskew = random(180);  
squares\_mc.tween("\_xskew", squares\_mc\_xskew, 1, ‘easeInOut’);  
//  
squares\_mc\_yskew = 180;  
squares\_mc.tween("\_yskew", squares\_mc\_yskew, 1);  
};

* * *

Thanks in advance!
