I will need to handle a piano key that can respond as fast as possible without high CPU load with repetitive key press and release on virtual piano in Flex application.
Is calling function much effective or Switch?
Example:
switch(keyNote)
case 'c4': keypress.button=down;
case 'c4': keypress.button=down;
case 'c4': keypress.button=down;
case 'c4': keypress.button=down;
case 'c4': keypress.button=down;
case 'c4': keypress.button=down;
or
function () {
if (keyNote=='c4'){keypress.button=down}
if (keyNote=='c4'){keypress.button=down}
if (keyNote=='c4'){keypress.button=down}
if (keyNote=='c4'){keypress.button=down}
}
or
function c4_Key() {
keypress.button=down;
}
I also wonder if there another method using dispatchevent to call a button by id and set button with down state?