actionscript 3 - Toggling one button to adjust two values -
i'm designing virtual simulation of physical machine controller has few face buttons. i'm trying arrow buttons scroll through menu , modify selected value when enter button clicked. right now, functions want to, when toggles menu control , scroll through, next value on menu (i.e. temperature 1,2,3) overwritten previous. snippet of code controls selected/unselected functionality, in enter frame event listener:
//--switches between scroll , edit--// if (changerswitch == true) { changermenu = changer; minvalue = menumin; maxvalue = menumax; screenmain.selectedshade.visible = false; screensmall.selectedshade.visible = false; } else { changervalue = changer; minvalue = valuemin; maxvalue = valuemax; screenmain.selectedshade.visible = true; screensmall.selectedshade.visible = true; } switch(mainmenuindex) { case 0: break; case 1: temperature1 = changervalue; break; case 2: temperature2 = changervalue; break; case 3: temperature3 = changervalue; break; default: break; }
mainmenuindex
reference number current menu option , set equal changermenu
. , down buttons add , subtract 1 value changer
. enter button flips changerswitch
boolean.
//--face buttons--// ws_btn_down.addeventlistener(mouseevent.mouse_down, f1_menudown); function f1_menudown(event: mouseevent): void { if (changer < maxvalue) { changer ++; } } ws_btn_up.addeventlistener(mouseevent.mouse_down, f1_menuup); function f1_menuup(event: mouseevent): void { if (changer > minvalue) { changer --; } } ws_btn_enter.addeventlistener(mouseevent.mouse_down, f1_menuenter); function f1_menuenter(event: mouseevent): void { if (changerswitch == true) { changerswitch = false; changer = changervalue; } else { changerswitch = true; changer = changermenu; } }
i don't know if best way this, i'm trying results. need in order value next selected menu option remain unchanged?
Comments
Post a Comment