how can i make button stay down state when i click it ? Help please
hi guys, i'm new @ code writing
i made drop down menu want make buttons stay down state until click button
here code :
concept1btn.visible = false;
concept2btn.visible = false;
concept3btn.visible = false;
concept4btn.visible = false;
concept5btn.visible = false;
concept6btn.visible = false;
this.addeventlistener(mouseevent.mouse_over,drop);
this.addeventlistener(mouseevent.mouse_out,up);
this.addeventlistener(mouseevent.mouse_down,down);
function drop(e:mouseevent) {
concept1btn.visible = true;
concept2btn.visible = true;
concept3btn.visible = true;
concept4btn.visible = true;
concept5btn.visible = true;
concept6btn.visible = true;
}
function up(e:mouseevent) {
concept1btn.visible = false;
concept2btn.visible = false;
concept3btn.visible = false;
concept4btn.visible = false;
concept5btn.visible = false;
concept6btn.visible = false;
}
function down(e:mouseevent) {
concept1btn.upstate = concept1btn.downstate;
concept1btn.overstate = concept1btn.downstate;
what else should add ???
}
use boolean var , upstate & downstate properties:
var _down: boolean = true; var buttonup: displayobject = my_btn.upstate; //store upstate use again function checkstatus(): void { if (_down == true) { my_btn.upstate = my_btn.downstate; _down = false; } else { my_btn.upstate = buttonup; _down = true; } } my_btn.addeventlistener(mouseevent.click, onclick); function onclick(event: mouseevent): void { checkstatus(); }
More discussions in ActionScript 3
adobe
Comments
Post a Comment