一些想法......和工作示例:
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
// #1 - use the proper variables / function names, upper and lower cases:
// Classes: Xxxxxx
// function : xxxxxx, xxxXxxxx
// variables : xxxxXxxx, xxxxx
// constants : XXXXXX
// #2 - use the readable function name, no shotcuts... ( just few advices );
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyboardDown);
function handleKeyboardDown( e :KeyboardEvent):void
{
// #3 - for keyboard events use switch instead...
// The error which was here is that the variable which parsed is named 'event' and you are using 'e',
// you need to use the same name as it being initialized
switch(e)
{
case Keyboard.ENTER :
// the error for your 'Calco()' function, is because
// function Calco (value.... expects for an variable.
// in this case this function does not required any variables
calculate();
break;
}
}
function calculate():void
{
trace (this);
}