Enable disable onPress and onRollOut button states

Hello everyone,

I’m having some trouble getting this code to work. I have two ‘doors’ that open when pressed and close when you rollout. The problem is that I need to disable the onRollOut if the button has been pressed. Otherwise when you rollover continuously it keeps trying to close the ‘doors’. Likewise when you press the doors they keep opening.

I’ve used an invisible button to activate the doors called screen_1 in the code below.
Hope someone can help as I new to this and it’s beginning to bug me!

Cheers


import mx.transitions.Tween;
import mx.transitions.easing.*;
// get start end / position of doors for tweening
var xpos_l:Number = door_l._x;
var xpos_r:Number = door_r._x;
var xpos_l_end:Number = (door_l._x-48);
var xpos_r_end:Number = (door_r._x+48);

// open doors when button pressed
screen_1.onPress = function() {
    new Tween(door_l, "_x", Bounce.easeOut, xpos_l, xpos_l_end, 1, true);
    new Tween(door_r, "_x", Bounce.easeOut, xpos_r, xpos_r_end, 1, true);
};
// close doors when button rollover 
screen_1.onRollOver = function() {
    new Tween(door_l, "_x", Bounce.easeOut, xpos_l_end, xpos_l, 1.5, true);
    new Tween(door_r, "_x", Bounce.easeOut, xpos_r_end, xpos_r, 1.5, true);
};