Code conversion AS1 to AS2

Hi,

I am trying to convert this AS1 code to AS2, but it just doesn’t work properly anymore.

The code below is attached to a movieclip (a background picture) that is constantly moving and it is supposed to duplicate that movieclip (the background picture) as soon as certain coordinates are reached.

Unfortunately my action script skills are aparently not good enough to figure out the changes.

Here’s the code:


onClipEvent (enterFrame)
{
    setProperty("", _x, _x + _root.dir);
    if (_xscale > myscale * 10)
    {
        setProperty("", _xscale, myscale * 10);
        setProperty("", _yscale, myscale * 10);
    } // end if
    if (_xscale < myscale * minXs)
    {
        setProperty("", _xscale, myscale * minXs);
        setProperty("", _yscale, myscale * minXs);
        minXT = true;
    } // end if
    if (_root.arrower.zoomin)
    {
        lastX = _x;
        if (minXT != true)
        {
            setProperty("", _x, obj_x * _root.arrower.scalefactor);
            setProperty("", _x, _x + _root.x);
        }
        else
        {
            setProperty("", _x, lastX);
            minXT = false;
        } // end else if
        setProperty("", _y, obj_y * _root.arrower.scalefactor);
    }
    else
    {
        setProperty("", _x, _x + _root.dx);
    } // end else if
    actual_W = getProperty(_level0.img, _width);
    actual_XF = getProperty(_level0.img, _xscale) / 100;
    actual_WXF = init_width * actual_XF;
    actual_R = _root.img._x + actual_WXF / 2 + (h - 1) * actual_WXF;
    actual_L = _root.img._x - actual_WXF / 2 - (i - 1) * actual_WXF;
    actual_T = _level0.img._y - _level0.img._height / 2;
    actual_B = _level0.img._y + _level0.img._height / 2;
    minY = 0;
    maxY = _root.movieH;
    minX = 0;
    maxX = _root.movieW;
    if (actual_L >= minX)
    {
        if (_root.panorama)
        {
            setProperty("", _x, _width / 2);
        }
        else
        {
            duplicateMovieClip(_level0.img.central, "left" + i, i + 10000);
            prevL = "left" + (i - 1);
            prevLX = getProperty(prevL, _x);
            setProperty("left" + i, _x, prevLX - init_width);
            i = i + 1;
            for (iDel = 1; iDel < h; iDel++)
            {
                removeMovieClip ("right" + iDel);
            } // end of for
            h = 1;
        } // end if
    } // end else if
    if (actual_R <= maxX + 500)
    {
        if (_root.panorama)
        {
            setProperty("", _x, _root.movieW - _width / 2);
        }
        else
        {
            duplicateMovieClip(_level0.img.central, "right" + h, h);
            prevR = "right" + (h - 1);
            prevRX = getProperty(prevR, _x);
            setProperty("right" + h, _x, prevRX + init_width);
            h = h + 1;
            for (hDel = 1; hDel < i; hDel++)
            {
                removeMovieClip ("left" + hDel);
            } // end of for
            i = 1;
        } // end if
    } // end else if
    if (actual_T >= minY)
    {
        setProperty("", _y, _height / 2);
    } // end if
    if (actual_B <= maxY)
    {
        setProperty("", _y, _root.movieH - _height / 2);
    } // end if
    actual_X = _x;
    actual_Y = _y;
}
onClipEvent (load)
{
    ok = ok2 = 1;
    beginX = _x;
    h = 1;
    i = 1;
    myscale = _xscale;
    minXs = _root.movieH / _height;
    init_width = _root.img.central._width;
    setProperty("central", _x, 0);
    setProperty("central", _y, 0);
}
onClipEvent (mouseDown)
{
    obj_x = _x - _root.x;
    obj_y = _y - _root.y;
}

Thanx for your help in advance !!

Mike