#!/usr/bin/perl -w # Flash Operator Panel. http://www.asternic.org # # Copyright (c) 2004 Nicolas Gudino. All rights reserved. # # Nicolas Gudino # # This program is free software, distributed under the terms of # the GNU General Public License. # # THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. use SWF qw(:ALL); use SWF::Constants qw(:Text :Button :DisplayItem :Fill); SWF::setScale(1); SWF::useSWFVersion(6); my $movie = new SWF::Movie(); $movie->setDimension(100, 100); $movie->setBackground(0xFF, 0xFF, 0xFF); $movie->setRate(30); $movie->add(new SWF::Action(<<"EndOfActionScript")); var dummyVar=(getTimer()+random(100000)); if(context != undefined) { context = context.toUpperCase(); colaEvento(0,"debug","contexto leido "+context); if(context == "DEFAULT") { context=""; } } else { colaEvento(0,"debug","context undefined"); context=""; } var archivo = "variables"+context+".txt?rand="+dummyVar; vr = new LoadVars (); vr.onLoad = function (success) { if (success == true) { colaEvento(0,"debug","Ok al leer "+archivo); nextFrame(); } else { colaEvento(0,"debug","Fallo al leer "+archivo); stop(); } }; vr.load(archivo); EndOfActionScript $movie->nextFrame(); $movie->add(new SWF::Action(<<"EndOfActionScript")); function conecta() { _global.sock = new XMLSocket; _global.sock.onConnect = handleConnect; _global.sock.onClose = handleDisconnect; _global.sock.onXML = handleXML; if(_global.port == undefined) { _global.port = 4445; } if(_global.server == undefined) { _global.sock.connect(null, _global.port); _global.server_print = "default"; } else { _global.sock.connect(_global.server, _global.port); _global.server_print = _global.server; } } function handleConnect(connectionStatus){ if (connectionStatus) { colaEvento(0,"debug","Conectado! con contexto: "+context); _global.reconecta = 0; if(_global.enable_crypto==1) { envia_comando("contexto", 0, 0); } else { envia_comando("contexto", 1, 0); } if(restrict != undefined) { envia_comando("restrict",restrict,0); } } else { colaEvento(0,"debug","No pude conectar!"); _global.reconecta = 1; } } function handleXML(doc){ var e = doc.firstChild; if (e != null) { if (e.nodeName == "response") { var numeroboton = e.attributes.btn; // btn is the button number var comando = e.attributes.cmd; var textofinal = e.attributes.data; if (_global.key != undefined) { if(_global.enable_crypto == 1) { comando = decrypt(comando, _global.key); if (textofinal.length > 0) { textofinal = decrypt(textofinal, _global.key); } } } var botonparte = numeroboton.split("@"); var boton_numero = botonparte[0]; var boton_contexto = botonparte[1]; var timernumber = 0; if (boton_contexto == undefined) { boton_contexto = ""; } if (_root.context == undefined) { _root.context = ""; } if (comando == "key") { _global.key = textofinal; return; } if (comando == "restrict") { _global.restrict = numeroboton; _global.mybutton = numeroboton; } if (comando == "version") { if(textofinal != _global.swfversion) { _global.statusline=vr.version_mismatch; } else { _global.statusline=""; } } if (_root.context == boton_contexto) { if(_global.restrict != undefined) { if(_global.restrict == boton_numero) { colaEvento(boton_numero,comando,textofinal); } } else { colaEvento(boton_numero,comando,textofinal); } } // endif root.context } // endif == response } // endiff e != null } function colaEvento(boton_numero,comando,textofinal) { if(_global.VersionFlash == "MAC") { // GetURL method for MAC jsQueue.push("javascript: docommand('"+boton_numero+"','"+comando+"','"+textofinal+"')"); } else { // FSCommand method for anything else jsQueue.push("newevent;"+boton_numero+"|"+comando+"|"+textofinal); } } function handleDisconnect(){ delete _global.key; _global.reconecta = 1; colaEvento(0,"debug","Attempt reconnection"); } Inicia_Variables = function () { _global.jsQueue = new Array(); var flashVersion = System.capabilities.version; var datos = flashVersion.split(" "); _global.VersionFlash = datos[0]; _global.server = vr.server; _global.port = vr.port; _global.enable_crypto = Number(vr.enable_crypto); if (isNaN(_global.enable_crypto)) { _global.enable_crypto=0; } else { if(_global.enable_crypto != 0) { _global.enable_crypto = 1; } } }; recarga = function () { if(_global.restart == 1) { // Send command to restart Asterisk envia_comando("restart","1","1"); } else { // Reloads FLASH client delete _global.key; var incontext = context; var inbutton = mybutton; var inrestrict = _global.restrict; var indial = dial; var innohighlight = nohighlight; for (var a in _root) { if (typeof (_root[a]) == "object") { removeMovieClip(_root[a]); } if (typeof (_root[a]) == "movieclip") { removeMovieClip(_root[a]); } } _global.context = incontext; _global.mybutton = inbutton; _global.restrict = inrestrict; _global.dial = indial; _global.nohighlight = inhighlight; stop(); gotoAndPlay(1); } }; _root.onEnterFrame = function() { if(_global.jsQueue.length>0) { if(_global.VersionFlash == "MAC") { getURL(jsQueue.shift()); } else { var partes = jsQueue.shift().split(";"); var comando=partes[0]; var params=partes[1]; getURL("FSCommand:"+comando,params); } } }; Timers = function () { if (_global.reconecta == 1) { delete setInterval; delete _global.key; recarga(); return; } }; setInterval(Timers, 10000); function ExtraeNumeroClip(name) { var destino = ""; name = name._name; for (var s = 0; s"9") { } else { destino = destino+""+c; } if (c == ".") { destino = ""; } } return destino; } envia_comando = function (comando, origen, destino) { if (comando != "bogus" && comando != "contexto" && comando != "restrict") { if (_global.restrict!=0) { if(comando == "cortar") { origen_number = ExtraeNumeroClip(origen); } else { origen_number = origen; } if(_global.restrict != undefined) { if (_global.restrict == origen_number ) { } else { return; } } } } message = new XML(); message_data = message.createElement("msg"); if (_root.context.length>0) { agrega_contexto = "@"+context; } if (agrega_contexto == undefined) { agrega_contexto = ""; } if (_level0.claveinput.secret == undefined) { _level0.claveinput.secret = ""; } if (_global.claveingresada == undefined && ( comando != "contexto" && comando != "bogus" && comando != "dial" && comando != "restrict")) { _root.codebox._visible = true; Selection.setFocus(_root.codebox.claveform); _root.codebox.swapDepths(_root.log); return; } // var clave=_level0.claveinput.secret+_global.key; var clave = _global.claveingresada+_global.key; var md5clave = ""; var md5clave = calcMD5(clave); if (comando == "contexto" || comando == "restrict") { md5clave = ""; } message_data.attributes.data = origen+agrega_contexto+"|"+comando+destino+"|"+md5clave; message.appendChild(message_data); _global.sock.send(message); var clave = ""; }; function LTrim(str) { var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { var j = 0, i = s.length; while (j=0 && whitespace.indexOf(s.charAt(i)) != -1) { i--; } s = s.substring(0, i+1); } return s; } function Trim(str) { return RTrim(LTrim(str)); } function setDND(obj, item) { var nroboton = ExtraeNumeroClip(obj); envia_comando("dnd", nroboton, nroboton); } function genera_selecttimeout() { _global.positionselect = 0; test = attachMovie("option","optionselected", getNextHighestDepth(), {_x:800, _y:6}); test._visible = true; test.legend = "No timeout"; test.onPress = function() { _root.despliega_select(); }; for (a=0; a<5; a++) { var b=a+1; if (_global.opcionesTimeout[a] != undefined) { testa = attachMovie("option","option"+a, getNextHighestDepth(), {_x:800, _y:(b*22)+6}); testa.legend = _global.opcionesTimeout[a]; testa._visible = false; testa.onRollOver = function() { this.legend = "* "+this.legend; }; testa.onRollOut = function() { this.legend = this.legend.substring(2, this.legend.length); }; testa.onPress = function() { this.legend = this.legend.substring(2, this.legend.length); var posicion = ExtraeNumeroClip(this); _global.timeout_value = _global.opcionesTimeoutSecs[posicion]; _root.muestra_selecttimeout(0); _root.selectbox1.gotoAndStop(1); _root.optionselected._visible=true; _root.optionselected.legend = this.legend; }; } } }; function muestra_selecttimeout(value) { for (a=0; a<5; a++) { var v = eval("_root.option"+a); if(value) { v._visible = true; } else { v._visible = false; } } }; function despliega_select() { _root.optionselected._visible=false; _root.selectbox1.gotoAndStop(2); _root.muestra_selecttimeout(1); }; function base64_decode(opString) { if ( opString == undefined ) { return; } var str = opString; var base64s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var bits, bit1, bit2, bit3, bit4, i = 0; var decOut = ""; for (i=0; i> 16, (bits & 0xff00) >> 8, bits & 0xff); } if (str.charCodeAt(i-2) == 61) { return decOut.substring(0, decOut.length-2); } else if (str.charCodeAt(i-1) == 61) { return decOut.substring(0, decOut.length-1); } else { return decOut.substring(0, decOut.length); } }; // MD5 ROUTINE /* * Convert a 32-bit number to a hex string with ls-byte first */ var hex_chr = "0123456789abcdef"; // // somehow the expression (bitAND(b, c) | bitAND((~b), d)) didn't return coorect results on Mac // for: // b&c = a8a20450, ((~b)&d) = 0101c88b, (bitAND(b, c) | bitAND((~b), d)) = a8a20450 <-- !!! // looks like the OR is not executed at all. // // let's try to trick the P-code compiler into working with us... Prayer beads are GO! // function bitOR(a, b) { var lsb = (a & 0x1) | (b & 0x1); var msb31 = (a >>> 1) | (b >>> 1); return (msb31 << 1) | lsb; } // // will bitXOR be the only one working...? // Nope. XOR fails too if values with bit31 set are XORed. // // Note however that OR (and AND and XOR?!) works alright for the statement // (msb31 << 1) | lsb // even if the result of the left-shift operation has bit 31 set. // So there might be an extra condition here (Guessmode turned on): // Mac Flash fails (OR, AND and XOR) if either one of the input operands has bit31 set // *and* both operands have one or more bits both set to 1. In other words: when both // input bit-patterns 'overlap'. // Stuff to munch on for the MM guys, I guess... // function bitXOR(a, b) { var lsb = (a & 0x1) ^ (b & 0x1); var msb31 = (a >>> 1) ^ (b >>> 1); return (msb31 << 1) | lsb; } // // bitwise AND for 32-bit integers. This uses 31 + 1-bit operations internally // to work around bug in some AS interpreters. (Mac Flash!) // function bitAND(a, b) { var lsb = (a & 0x1) & (b & 0x1); var msb31 = (a >>> 1) & (b >>> 1); return (msb31 << 1) | lsb; // return (a & b); } // // Add integers, wrapping at 2^32. This uses 16-bit operations internally // to work around bugs in some AS interpreters. (Mac Flash!) // function addme(x, y) { var lsw = (x & 0xFFFF)+(y & 0xFFFF); var msw = (x >> 16)+(y >> 16)+(lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } function rhex(num) { str = ""; for (j=0; j<=3; j++) { str += hex_chr.charAt((num >> (j*8+4)) & 0x0F)+hex_chr.charAt((num >> (j*8)) & 0x0F); } return str; } /* * Convert a string to a sequence of 16-word blocks, stored as an array. * Append padding bits and the length, as described in the MD5 standard. */ function str2blks_MD5(str) { nblk = ((str.length+8) >> 6)+1; // 1 + (len + 8)/64 blks = new Array(nblk*16); for (i=0; i> 2] |= str.charCodeAt(i) << (((str.length*8+i)%4)*8); } blks[i >> 2] |= 0x80 << (((str.length*8+i)%4)*8); var l = str.length*8; blks[nblk*16-2] = (l & 0xFF); blks[nblk*16-2] |= ((l >>> 8) & 0xFF) << 8; blks[nblk*16-2] |= ((l >>> 16) & 0xFF) << 16; blks[nblk*16-2] |= ((l >>> 24) & 0xFF) << 24; return blks; } /* * Bitwise rotate a 32-bit number to the left */ function rol(num, cnt) { return (num << cnt) | (num >>> (32-cnt)); } /* * These functions implement the basic operation for each round of the * algorithm. */ function cmn(q, a, b, x, s, t) { return addme(rol((addme(addme(a, q), addme(x, t))), s), b); } function ff(a, b, c, d, x, s, t) { return cmn(bitOR(bitAND(b, c), bitAND((~b), d)), a, b, x, s, t); } function gg(a, b, c, d, x, s, t) { return cmn(bitOR(bitAND(b, d), bitAND(c, (~d))), a, b, x, s, t); } function hh(a, b, c, d, x, s, t) { return cmn(bitXOR(bitXOR(b, c), d), a, b, x, s, t); } function ii(a, b, c, d, x, s, t) { return cmn(bitXOR(c, bitOR(b, (~d))), a, b, x, s, t); } /* * Take a string and return the hex representation of its MD5. */ function calcMD5(str) { x = str2blks_MD5(str); a = 1732584193; b = -271733879; c = -1732584194; d = 271733878; var step; for (i=0; i=ls) { break; } var pepe=s.charAt(is); if (c2b[s.charAt(is)] == null) { b[is] = 0xF7; } else { b[is] = c2b[s.charAt(is)]; } is++; } return b; } function bytes2str(b) { var ib = 0; var lb = b.length; var s = ''; while (1) { if (ib>=lb) { break; } if (b2c[0xFF & b[ib]]!=undefined) { s += b2c[0xFF & b[ib]]; } ib++; } return s; } function ascii2bytes(a) { var ia = -1; var la = a.length; var ib = 0; var b = new Array(); var carry; while (1) { // reads 4 chars and produces 3 bytes while (1) { ia++; if (ia>=la) { return b; } if (a2b[a.charAt(ia)] != null) { break; } } b[ib] = a2b[a.charAt(ia)] << 2; while (1) { ia++; if (ia>=la) { return b; } if (a2b[a.charAt(ia)] != null) { break; } } carry = a2b[a.charAt(ia)]; b[ib] |= carry >>> 4; ib++; carry = 0xF & carry; if (carry == 0 && ia == (la-1)) { return b; } b[ib] = carry << 4; while (1) { ia++; if (ia>=la) { return b; } if (a2b[a.charAt(ia)] != null) { break; } } carry = a2b[a.charAt(ia)]; b[ib] |= carry >>> 2; ib++; carry = 3 & carry; if (carry == 0 && ia == (la-1)) { return b; } b[ib] = carry << 6; while (1) { ia++; if (ia>=la) { return b; } if (a2b[a.charAt(ia)] != null) { break; } } b[ib] |= a2b[a.charAt(ia)]; ib++; } return b; } function bytes2ascii(b) { var ib = 0; var lb = b.length; var s = ''; var b1; var b2; var b3; var carry; while (1) { // reads 3 bytes and produces 4 chars if (ib>=lb) { break; } b1 = 0xFF & b[ib]; s += b2a[63 & (b1 >>> 2)]; carry = 3 & b1; ib++; if (ib>=lb) { s += b2a[carry << 4]; break; } b2 = 0xFF & b[ib]; s += b2a[(0xF0 & (carry << 4)) | (b2 >>> 4)]; carry = 0xF & b2; ib++; if (ib>=lb) { s += b2a[carry << 2]; break; } b3 = 0xFF & b[ib]; s += b2a[(60 & (carry << 2)) | (b3 >>> 6)]+b2a[63 & b3]; ib++; if (ib%36 == 0) { s += "\n"; } } return s; } function bytes2blocks(bytes) { var blocks = new Array(); var ibl = 0; var iby = 0; var nby = bytes.length; while (1) { blocks[ibl] = (0xFF & bytes[iby]) << 24; iby++; if (iby>=nby) { break; } blocks[ibl] |= (0xFF & bytes[iby]) << 16; iby++; if (iby>=nby) { break; } blocks[ibl] |= (0xFF & bytes[iby]) << 8; iby++; if (iby>=nby) { break; } blocks[ibl] |= 0xFF & bytes[iby]; iby++; if (iby>=nby) { break; } ibl++; } return blocks; } function blocks2bytes(blocks) { var bytes = new Array(); var iby = 0; var ibl = 0; var nbl = blocks.length; while (1) { if (ibl>=nbl) { break; } bytes[iby] = 0xFF & (blocks[ibl] >>> 24); iby++; bytes[iby] = 0xFF & (blocks[ibl] >>> 16); iby++; bytes[iby] = 0xFF & (blocks[ibl] >>> 8); iby++; bytes[iby] = 0xFF & blocks[ibl]; iby++; ibl++; } return bytes; } function digest_pad(bytearray) { var newarray = new Array(); var ina = 0; var iba = 0; var nba = bytearray.length; var npads = 15-(nba%16); newarray[ina] = npads; ina++; while (iba0) { newarray[ina] = 0; ina++; ip--; } return newarray; } function pad(bytearray) { var newarray = new Array(); var ina = 0; var iba = 0; var nba = bytearray.length; var npads = 7-(nba%8); newarray[ina] = (0xF8 & rand_byte()) | (7 & npads); ina++; while (iba0) { newarray[ina] = rand_byte(); ina++; ip--; } return newarray; } function rand_byte() { return Math.floor(256*Math.random()); if (!rand_byte_already_called) { var now = new Date(); seed = now.milliseconds; rand_byte_already_called = true; } seed = (1029*seed+221591)%1048576; return Math.floor(seed/4096); } function unpad(bytearray) { var iba = 0; var newarray = new Array(); var ina = 0; var npads = 0x7 & bytearray[iba]; iba++; var nba = bytearray.length-npads; while (iba=nbl) { break; } v0[0] = blocks[ibl]; ibl++; v0[1] = blocks[ibl]; ibl++; v1[0] = blocks[ibl]; ibl++; v1[1] = blocks[ibl]; ibl++; c0 = tea_code(xor_blocks(v0, c0), key); c1 = tea_code(xor_blocks(v1, c1), key); swap = c0[0]; c0[0] = c0[1]; c0[1] = c1[0]; c1[0] = c1[1]; c1[1] = swap; } var concat = new Array(); concat[0] = c0[0]; concat[1] = c0[1]; concat[2] = c1[0]; concat[3] = c1[1]; return concat; } function encrypt(str, keystr) { var key = new Array(); key = binarydigest(keystr); var blocks = new Array(); blocks = bytes2blocks(pad(str2bytes(str))); var ibl = 0; var nbl = blocks.length; // Initial Value for CBC mode = "abcdbcde". Retain for interoperability. var c = new Array(); c[0] = 0x61626364; c[1] = 0x62636465; var v = new Array(); var cblocks = new Array(); var icb = 0; while (1) { if (ibl>=nbl) { break; } v[0] = blocks[ibl]; ibl++; v[1] = blocks[ibl]; ibl++; c = tea_code(xor_blocks(v, c), key); cblocks[icb] = c[0]; icb++; cblocks[icb] = c[1]; icb++; } return binary2ascii(cblocks); } function decrypt(ascii, keystr) { var key = new Array(); key = binarydigest(keystr); var cblocks = new Array(); cblocks = ascii2binary(ascii); var icbl = 0; var ncbl = cblocks.length; var lastc = new Array(); lastc[0] = 0x61626364; lastc[1] = 0x62636465; var v = new Array(); var c = new Array(); var blocks = new Array(); var ibl = 0; while (1) { if (icbl>=ncbl) { break; } c[0] = cblocks[icbl]; icbl++; c[1] = cblocks[icbl]; icbl++; v = xor_blocks(lastc, tea_decode(c, key)); blocks[ibl] = v[0]; ibl++; blocks[ibl] = v[1]; ibl++; lastc[0] = c[0]; lastc[1] = c[1]; } return bytes2str(unpad(blocks2bytes(blocks))); } function xor_blocks(blk1, blk2) { var blk = new Array(); blk[0] = blk1[0] ^ blk2[0]; blk[1] = blk1[1] ^ blk2[1]; return blk; } function tea_code(v, k) { var v0 = v[0]; var v1 = v[1]; var k0 = k[0]; var k1 = k[1]; var k2 = k[2]; var k3 = k[3]; var sum = 0; var n = 32; while (n-->0) { sum -= 1640531527; // TEA magic number 0x9e3779b9 sum = sum | 0; v0 += ((v1 << 4)+k0) ^ (v1+sum) ^ ((v1 >>> 5)+k1); v1 += ((v0 << 4)+k2) ^ (v0+sum) ^ ((v0 >>> 5)+k3); } var w = new Array(); w[0] = v0 | 0; w[1] = v1 | 0; return w; } function tea_decode(v, k) { var v0 = v[0]; var v1 = v[1]; var k0 = k[0]; var k1 = k[1]; var k2 = k[2]; var k3 = k[3]; var sum = 0; var n = 32; sum = -957401312; while (n-->0) { v1 -= ((v0 << 4)+k2) ^ (v0+sum) ^ ((v0 >>> 5)+k3); v0 -= ((v1 << 4)+k0) ^ (v1+sum) ^ ((v1 >>> 5)+k1); sum += 1640531527; sum = sum | 0; } var w = new Array(); w[0] = v0 | 0; w[1] = v1 | 0; return w; } Key.addListener(Key); Key.onKeyDown = function(){ var incremento = 1; var tecla = Key.getCode(); if(tecla == 16) { _global.shift = 1; } if(tecla == 40) // DOWN { // Select next button DOWN myapaga = eval('_root.resaltado'+_global.rectanguloprendido); dif1 = (_global.rectanguloprendido) % _root.cuantas_filas; incremento = 1; if(dif1 == 0) { // It changed the column, increment it again incremento = incremento - _root.cuantas_filas; } proximo = _global.rectanguloprendido + incremento; var myresa = eval('_root.resaltado'+proximo); if(_global.rectanguloprendido != _global.restrict) { myapaga._visible = false; } myresa._visible = true; _global.rectanguloprendido = proximo; _root.makeStatus(proximo); } if(tecla == 38) // UP { // Select next button UP myapaga = eval('_root.resaltado'+_global.rectanguloprendido); dif1 = (_global.rectanguloprendido-1) % _root.cuantas_filas; incremento = -1; if(dif1 == 0) { // It changed the column, increment it again incremento = incremento + _root.cuantas_filas; } proximo = _global.rectanguloprendido + incremento; var myresa = eval('_root.resaltado'+proximo); if(_global.rectanguloprendido != _global.restrict) { myapaga._visible = false; } myresa._visible = true; _global.rectanguloprendido = proximo; _root.makeStatus(proximo); } if(tecla == 37) // LEFT { if (_root.superdetails._visible == true) { var tab = _root.superdetails.tab1._currentframe; if(tab == 2) { _root.superdetails.tab1.gotoAndStop(1); _root.superdetails.tab2.gotoAndStop(2); _root.superdetails.texto = _global.superdetailstexttab1; } else { _root.superdetails.tab1.gotoAndStop(2); _root.superdetails.tab2.gotoAndStop(1); _root.superdetails.texto = _global.superdetailstexttab2; } } else { // Select next button on the LEFT myapaga = eval('_root.resaltado'+_global.rectanguloprendido); incremento = _root.cuantas_filas; diferencia = _global.rectanguloprendido % _root.cuantas_filas; proximo = _global.rectanguloprendido - incremento; if(proximo < 1) { proximo = ((_root.cuantas_columnas - 1) * _root.cuantas_filas)+diferencia; } var myresa = eval('_root.resaltado'+proximo); if(_global.rectanguloprendido != _global.restrict) { myapaga._visible = false; } myresa._visible = true; _global.rectanguloprendido = proximo; _root.makeStatus(proximo); } } if(tecla == 39) // RIGHT { if(_root.detail._visible == true) { _root.superdetails._visible = true; _root.detail._visible = false; } else if (_root.superdetails._visible == true) { var tab = _root.superdetails.tab1._currentframe; if(tab == 2) { _root.superdetails.tab1.gotoAndStop(1); _root.superdetails.tab2.gotoAndStop(2); _root.superdetails.texto = _global.superdetailstexttab1; } else { _root.superdetails.tab1.gotoAndStop(2); _root.superdetails.tab2.gotoAndStop(1); _root.superdetails.texto = _global.superdetailstexttab2; } } else { // Select next button on the RIGHT myapaga = eval('_root.resaltado'+_global.rectanguloprendido); total = _root.cuantas_filas * _root.cuantas_columnas; incremento = _root.cuantas_filas; diferencia = _global.rectanguloprendido % _root.cuantas_filas; proximo = _global.rectanguloprendido + incremento; if(proximo > total) { proximo = 1+diferencia-1; } var myresa = eval('_root.resaltado'+proximo); if(_global.rectanguloprendido != _global.restrict) { myapaga._visible = false; } myresa._visible = true; _global.rectanguloprendido = proximo; _root.makeStatus(proximo); } } if(tecla == 9) // TAB { myapaga = eval('_root.resaltado'+_global.rectanguloprendido); total = _root.cuantas_filas * _root.cuantas_columnas; if(_global.shift == 1) { incremento = -1; } else { incremento = 1; } proximo = _global.rectanguloprendido + incremento; if(proximo > total) { proximo = 1; } if(proximo < 1) { proximo = total; } var myresa = eval('_root.resaltado'+proximo); if(_global.rectanguloprendido == _global.restrict) { myapaga._visible = false; } myresa._visible = true; _global.rectanguloprendido = proximo; _root.makeStatus(proximo); } if(tecla == 27) // ESC { _root.codebox._visible = false; _root.log._visible = false; _root.detail._visible = false; _root.superdetails._visible = false; } if(tecla == 18) // ALT { var myon = _global.rectanguloprendido; if(myon>0) { var myclip = eval('_level0.rectangulo'+myon+'.flecha'+myon); _root.displaydetails(myclip); } } if(tecla == 13) // ENTER { if(_root.codebox._visible == true) { // The security code box is visible, sends code and hides it _global.claveingresada = _root.codebox.claveform.text; _root.codebox._visible = false; _root.envia_comando('bogus', 0, 0); } else { // The security code is not visible, open detail windows of // highlighted button var myon = _global.rectanguloprendido; if(myon>0) { var myclip = eval('_level0.rectangulo'+myon+'.flecha'+myon); _root.displaydetails(myclip); } } } }; Key.onKeyUp = function(){ var tecla = Key.getCode(); if(tecla == 16) { _global.shift = 0; } }; Inicia_Variables(); conecta(); EndOfActionScript # Saves the movie $movie->nextFrame(); $movie->save("comunicator.swf",9);