Muy buenas... a ver si alguien vé qué falla aquí, porque creo que estoy desarrollando cegera al bug (un clásico cuando llevas 4 horas mirando el mismo fichero...)
Tengo una aplicación (bastante simple, por otra parte) con un sistema de control de teclas casero: class com.foo.bar.SoftKeys { var default_keys = null; // Array to store a history of key assignments var key_history:Array = []; // Key controller var key_controller:Object = null; function SoftKeys(){ trace( "Creating SoftKeys instance..." ); softkey = this; } function toString(){ return "SoftKeys"; } function on_softkey_1(){ trace( "SoftKeys.on_softkey_1()" ); } function on_softkey_2(){ trace( "SoftKeys.on_softkey_2()" ); } private function init_softkey_controller(){ trace( softkey + ".init_softkey_controller" ); if(!key_controller){ key_controller = new Object(); } else { return; } key_controller.onKeyDown = function(){ var pressed_key = Key.getCode(); switch ( pressed_key ) { case "soft1": // Soft key 1 trace( "SoftKeys.onKeyDown - soft1" ); trace( on_softkey_1 ); on_softkey_1(); break; case "soft2": // Soft key 2 trace( "SoftKeys.onKeyDown - soft2" ); trace( on_softkey_2 ); on_softkey_2(); break; default: break; } } Key.addListener(key_controller); } public function set_soft_keys(labels:Array,functions:Array){ init_softkey_controller(); trace( "SoftKeys.set_soft_keys - Storing soft keys in history" ); key_history.push([labels,functions]); fscommand2("SetSoftKeys",labels[0],labels[1]); this.on_softkey_1 = functions[0]; this.on_softkey_2 = functions[1]; } public function reset_soft_keys(){ trace( "SoftKeys.reset_soft_keys - Retrieving previous keys from history" ); var previous_keys = key_history.pop(); set_soft_keys(previous_keys[0],previous_keys[1]); } } Tengo una instancia de esta clase en la aplicación, y cuando pulso las teclas correspondientes se me dispara el trace ( "SoftKeys.onKeyDown - softX" ), pero trace(on_softkey_X) me devuelve undefined, y jamás se llama a la función on_softkey_X. ¿Alguna idea de qué puede estar fallando? Miles de millones de gracias por adelantado... -- Ale Muñoz http://sofanaranja.com http://bomberstudios.com ----------------------------------------------------- ASNativos www.5dms.com subscripciones/desubscripciones http://asnativos.5dms.com -----------------------------------------------------