Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/05/2010, 11:15
polo_W12
 
Fecha de Ingreso: enero-2008
Ubicación: Concepción, Chile
Mensajes: 76
Antigüedad: 16 años, 3 meses
Puntos: 3
Respuesta: desactivar menu de flash

Cita:
Iniciado por danistrein Ver Mensaje
hola amigos estoy aprendiendo flash y intento desactivar el menu cuando haces click derecho, me funciona con as2, pero no me funciona con as3.

alguien sabe como desactivar el menu en as3?
y de paso aprovecho para preguntar:
alguien sabe como agregarle otras opciones al menu? es decir crear un menu con as3 al hacer click derecho que salga junto con "Acerca de Adobe Flash....".

Amigo esto te debiera simplificar las cosas bastante.

Código actionscript:
Ver original
  1. import flash.net.URLRequest;
  2. import flash.net.URLLoader;
  3. import flash.net.*
  4.  
  5.  
  6. var menu:ContextMenu = new ContextMenu  ;
  7. menu.hideBuiltInItems();
  8.  
  9. var arreglolinks:Array      = new Array("http://www.google.cl/::GOOGLE", "http://www.lun.cl/::LUN");
  10. var totallinks:Number       = arreglolinks.length;
  11. var vinculo:Array           = new Array();
  12.  
  13. init();
  14.  
  15. function init():void{
  16.     var i:Number = 0;
  17.     for(i=0;i<totallinks;i++){
  18.         var tmp:Array   = arreglolinks[i].split("::");
  19.         var elemento:ContextMenuItem = new ContextMenuItem(tmp[1]);
  20.         elemento.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,linkear);
  21.         menu.customItems.push(elemento);
  22.     }
  23.     this.contextMenu=menu;
  24. }
  25.  
  26. function linkear(e:ContextMenuEvent):void{
  27.     var a:String=e.currentTarget.caption;
  28.     var i:Number = 0;
  29.     for(i=0;i<totallinks;i++){
  30.         var tmp:Array   = arreglolinks[i].split("::");
  31.         if(a==tmp[1]){
  32.             trace(tmp[0]);
  33.             if(tmp[0]){
  34.                 var targetURL:URLRequest=new URLRequest(tmp[0]);
  35.                 navigateToURL(targetURL, "_blank");
  36.             }
  37.         }
  38.     }
  39. }

Espero haberte sido de ayuda.
Saluda Atte.
Claudio Barrera Asencio.