Tween Class actionscript errors, please assist

Hi all,

I’m trying to create a gallery of thumbnail with a left and right button. I tried to turn off the LEFT button when the thumbnail has reached the extreme end, which is x = 0, but it isn’t working. I could only write basic actionscript with the help of the Kirupa tutorial, and could not understand why it isn’t working.


import mx.transitions.Tween;// Import tween class
import mx.transitions.easing.*;// Import easing class

leftButton.onPress = function() {
    if (mcName._x<=-910) {
        var myTween:Tween = new Tween(leftButton, "_alpha", Strong.easeIn, 100, 0, 3, true);
    } else {
        var myTween:Tween = new Tween(mcName, "_x", Strong.easeInOut, mcName._x, mcName._x+970, 10, false);
    }
}

rightButton.onPress = function() {
    if (mcName._x=>2700) {
        var myTween:Tween = new Tween(rightButton, "_alpha", Strong.easeIn, 100, 0, 3, true);
    } else {
        var myTween:Tween = new Tween(mcName, "_x", Strong.easeInOut, mcName._x, mcName._x-970, 10, false);
    }
}

But the code couldn’t work :(.

This is my code for the thumbnail gallery that works WITHOUT me messing up the script:


import mx.transitions.Tween;// Import tween class
import mx.transitions.easing.*;// Import easing class

leftButton.onPress = function() {
    var myTween:Tween = new Tween(mcName, "_x", Strong.easeInOut, mcName._x, mcName._x+970, 10, false);
    delete leftButton.onEnterFrame;
};

rightButton.onPress = function() {
    var myTween:Tween = new Tween(mcName, "_x", Strong.easeInOut, mcName._x, mcName._x-970, 10, false);
    delete rightButton.onEnterFrame;
};

Will appreciate if anyone could enlighten me. Really, really thanks in advance.