I was wondering if someone could help me out with this section of the code below:
_root.container2._y = -35;
_root.container2._x = 10;
I want to say when both of these equal these values, then delete the onEnterFrame function. I have tried handling it similar to this line:
if (_root.container2._y <= -35 && _root.container2._x <= 10)
but can’t seem to get it to work. As it stands, the container2 clip moves until it reaches a y value of -35, where it then snaps to the original x value and stops (deletes the onEnterFrame)
How do I get them to work together?
_root.container2.loadMovie("CBSname2.swf");
function moveCBS() {
clearInterval(moveCBSInterval);
_root.container2.onEnterFrame = function() {
_root.container2._y -= 5;
_root.container2._x -= 5;
if (_root.container2._y <= -35 && _root.container2._x <= 10) {
_root.container2._y = -35;
_root.container2._x = 10;
delete this.onEnterFrame;
}
};
}
moveCBSinterval = setInterval(moveCBS, 1000);