Getting back in the game here - used to use AS2 for a lot of my websites and stuff - and want to get back into it, however, having issues getting used to AS3 - for example, I used this code to create neat scrolling backgrounds that moved with my mouse in AS2, but they will no longer work in AS3. How would I go about converting this code to AS3? What are the main differences and issues?
this.onMouseMove = function() {
constrainedMove(BackGroundBar,4,1);
};
function constrainedMove(target:MovieClip, speed:Number, dir:Number) {
var mousePercent:Number = _xmouse/Stage.width;
var mSpeed:Number;
if (dir ==0) {
mSpeed = 1-mousePercent;
} else {
mSpeed = mousePercent;
}
target.destX = Math.round(-((target._width-Stage.width)mSpeed));
target.onEnterFrame = function() {
if (target._x == target.destX) {
delete target.onEnterFrame;
} else {
target._x += Math.ceil((target.destX-target._x)(speed/100));
}
};
}