Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/09/2012, 14:34
Avatar de yonic
yonic
 
Fecha de Ingreso: abril-2010
Mensajes: 21
Antigüedad: 14 años
Puntos: 3
Respuesta: Menú con .as3 no me separa las funciones

Creo que el problema radica en la sentencia "switch .. case". Prueba combinando las sentencias que tengan condiciones iguales, algo así:

Código actionscript:
Ver original
  1. var arrBotones:Array=[textos_mc.btn_1,textos_mc.btn_2,textos_mc.btn_3];
  2. //
  3. for each (var btn:MovieClip in arrBotones) {
  4.     btn.addEventListener(MouseEvent.CLICK,hizoClick);
  5.     btn.buttonMode=true;
  6. }
  7. //
  8. function hizoClick(e:MouseEvent):void {
  9.     var btn:MovieClip=e.currentTarget as MovieClip;
  10.     switch (btn) {
  11.         case arrBotones[0] :
  12.             if (MovieClip(root).textos_mc.currentFrame==2) {
  13.                 fscommand("exec","animacion_2.exe");
  14.                 fscommand("exec","animacion_2.app");
  15.             } else if (MovieClip(root).textos_mc.currentFrame == 3) {
  16.                 fscommand("exec","animacion_3.exe");
  17.                 fscommand("exec","animacion_3.app");
  18.                 break;
  19.             }
  20.         case arrBotones[1] :
  21.             if (MovieClip(root).textos_mc.currentFrame==2) {
  22.                 fscommand("exec","video_2.exe");
  23.                 fscommand("exec","video_2.app");
  24.                 break;
  25.             } else if (MovieClip(root).textos_mc.currentFrame == 3) {
  26.                 fscommand("exec","video_3.exe");
  27.                 fscommand("exec","video_3.app");
  28.                 break;
  29.             }
  30.         case arrBotones[2] :
  31.             if (MovieClip(root).textos_mc.currentFrame==2) {
  32.                 fscommand("exec","texto_2.bat");
  33.                 fscommand("exec","texto_2.app");
  34.                 break;
  35.             } else if (MovieClip(root).textos_mc.currentFrame == 3) {
  36.                 fscommand("exec","texto_3.exe");
  37.                 fscommand("exec","texto_3.app");
  38.                 break;
  39.             }
  40.     }
  41. }

Espero que te sirva.