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
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]import[/COLOR] mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]Tween[/COLOR];
[COLOR=#0000FF]import[/COLOR] mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].;
[COLOR=#808080]// get start end / position of doors for tweening*[/COLOR]
[COLOR=#000000]var[/COLOR] xpos_l:[COLOR=#0000FF]Number[/COLOR] = door_l.[COLOR=#0000FF]_x[/COLOR];
[COLOR=#000000]var[/COLOR] xpos_r:[COLOR=#0000FF]Number[/COLOR] = door_r.[COLOR=#0000FF]_x[/COLOR];
[COLOR=#000000]var[/COLOR] xpos_l_end:[COLOR=#0000FF]Number[/COLOR] = COLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] xpos_r_end:[COLOR=#0000FF]Number[/COLOR] = COLOR=#000000[/COLOR];
[COLOR=#808080]// open doors when button pressed[/COLOR]
screen_[COLOR=#000080]1[/COLOR].[COLOR=#0000FF]onPress[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]door_l, [COLOR=#FF0000]"_x"[/COLOR], Bounce.[COLOR=#000080]easeOut[/COLOR], xpos_l, xpos_l_end, [COLOR=#000080]1[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]door_r, [COLOR=#FF0000]“x"[/COLOR], Bounce.[COLOR=#000080]easeOut[/COLOR], xpos_r, xpos_r_end, [COLOR=#000080]1[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#808080]*// close doors when button rollover *[/COLOR]
screen[COLOR=#000080]1[/COLOR].[COLOR=#0000FF]onRollOver[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]door_l, [COLOR=#FF0000]”_x"[/COLOR], Bounce.[COLOR=#000080]easeOut[/COLOR], xpos_l_end, xpos_l, [COLOR=#000080]1[/COLOR].[COLOR=#000080]5[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]new[/COLOR] Tween[COLOR=#000000]([/COLOR]door_r, [COLOR=#FF0000]"_x"[/COLOR], Bounce.[COLOR=#000080]easeOut[/COLOR], xpos_r_end, xpos_r, [COLOR=#000080]1[/COLOR].[COLOR=#000080]5[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR];
[/LEFT]
[/FONT]