Wednesday, July 4, 2012

[Action Script] Code conversion from AS2 to AS3 help! July,2012

Hello all,
Im in need of some help in converting a few blocks of code from AS2 to AS3. I will not be using these codes in external .as files, and will need them to be used directly on the stage in the main timeline of the specific movieclips. One deals with conditional statement that scales a background image up when the browser window becomes larger than the specified stage size within the code, but remains the same size when on smaller monitors. Code is below:

if (Stage.width>1920 || Stage.height>1200)
{
mainSitebg._width = Stage.width;
mainSitebg._height = Stage.height;

mainSitebg._xscale > mainSitebg._yscale ?
mainSitebg._yscale = mainSitebg._xscale :

mainSitebg._xscale = mainSitebg._yscale;
}
var stageL:Object = new Object();
stageL.onResize = function() {

if (Stage.width>1920 || Stage.height>1200)
{

mainSitebg._width = Stage.width;
mainSitebg._height = Stage.height;

mainSitebg._xscale > mainSitebg._yscale ?
mainSitebg._yscale = mainSitebg._xscale :


mainSitebg._xscale = mainSitebg._yscale;
}
Stage.addListener(stageL);

The next bit of code deals with a parallax effect with individual movieclips. That code is below also:

orig_x = this._x;
orig_y = this._y;
profundidad = 20;
this.swapDepths(profundidad);

onEnterFrame = function() {
dest_x = (((210 - _root._xmouse)/400) * profundidad) + orig_x;
incr_x = (dest_x - this._x)/10;
this._x += incr_x;
dest_y = (((130 - _root._ymouse)/330) * profundidad) + orig_y;
incr_y = (dest_y - this._y)/10;
this._y += incr_y;
}

Ant help would be very much appretiated! Thank you to anyone that may help!
Cheers!
Code conversion from AS2 to AS3 help!

Related Post



0 comments: