Dropdown-menu

Code Actionscript 2.0

Instance action

onClipEvent (load) {
open = 1;
}
on (press) {
if (open == 0) {
//if closed -> open
open = 1;
_root.b1._visible = 1;
_root.b2._visible = 1;
_root.b3._visible = 1;
} else {
// if open -> close
open = 0;
_root.b1._visible = 0;
_root.b2._visible = 0;
_root.b3._visible = 0;
}
}

Code Actionscript 3.0

b0.addEventListener(MouseEvent.MOUSE_DOWN, press); b0.open = true; function press(e:MouseEvent) { if (b0.open == false) { //if closed -> open b0.open = true; b1.visible = 1; b2.visible = 1; b3.visible = 1; } else { // if open -> close b0.open = false; b1.visible = 0; b2.visible = 0; b3.visible = 0; } }

Description

This example is a simple dropdown menu. When it is clicked, the variable open toggles between 1 and 0, and the menubuttons toggle between visible and invisible.

related to: Switch

Download

Right click: Flashfile AS 2.0 | Flashfile AS 3.0 | SWF-File


Share