Comunidad de diseño web y desarrollo en internet online

solo me coje una palabra... [Buscador]

Citar            
MensajeEscrito el 05 Abr 2005 02:50 pm
He encontrado lo que queria pero solo me funciona con una palabra a la que pongo una frase o un largo contenido se rompe... La url del archivo ahora mismo no me acuerdo cual es luego os la busco i os digo de dode lo saque pero os pongo el codigo para haber si me podeis ayudar. Eso si lo encontre en los foros de flashkit.

Esto esta en el primer frame:

Código :

stop();
_root.nameBut.enabled = false;
//this is the function for the search engine
function searchSite() {
   flashSite = new XML();
   flashSite.load("url_flashkit_goto.xml");
   flashSite.onLoad = findSite;
   if (this.loaded) {
   headline = "Text loaded."
}else{
   headline = "Text not yet loaded."
}
   //with this function we will get access to the xml tree
   function findSite() {
      
      //"flashSite" contains the xml file
      for (var count01=0; count01 <= flashSite.childNodes.length; count01++) {
         if (this.childNodes[count01].nodeName.toLowerCase() == "flashkit") {
            flashkitContent = this.childNodes[count01];
            }
      }
      findUrl(flashkitContent);   
}
function findUrl(thisUrl) {
   for (var count02=0; count02<=thisUrl.childNodes.length; count02++) {
      //we are defining the var modelName here
      urlName = thisUrl.childNodes[count02].nodeName.toLowerCase();
      //the string from the input textfield is compared 
      //with the name of the childnodes
      if (searchWindow.toLowerCase() == urlName && urlName != undefined) {
         //if there is a match we do all this
         thisName = thisUrl.childNodes[count02].attributes.name;
         headline = thisUrl.childNodes[count02].attributes.action;
         urlText = thisUrl.childNodes[count02].attributes.myUrl;
         frameNumber = thisUrl.childNodes[count02].attributes.frame;
         //the button will appear..
         _root.nameBut.enabled = true;
         _root.nameBut._alpha = 50;
         //if there is no match...
         //we cannot use urlName here because this still holds more child node names
         //and this statement will always be executed, so we use thisName.
         //urlText is undefined: if the user presses the submit button w/o adding text
         //this will be executed if urlText is undefined.
      }else if (searchWindow.toLowerCase() != thisName.toLowerCase()  || urlText == undefined){
         //the button is disabled
         _root.nameBut.enabled = false;
         //the button will not appear
         _root.nameBut._alpha = 0;
         headline = "Sorry, no match.";
          }
        }
   }
}
//here we define the function for the button containing the frame number 
function myFrame(){
      gotoAndStop(frameNumber);
}
//here we define the function for the button containing the url and the 
//browser target window
function myUrl(){
      getURL(urlText,"_blank");
}


Y este este el XML:

Código :

<?xml version="1.0"?>
<flashkit>
<flashmx name="flashmx" myUrl="http://flashkit.com/board/forumdisplay.php?forumid=61" frame="2" action="Press to go to the Flash MX forum.">
</flashmx>
<flash5 name="flash5" myUrl="http://board.flashkit.com/board/forumdisplay.php?forumid=26" frame="3" action="Press to go to the Flash 5 forum.">
</flash5>
<tutorials name="tutorials" myUrl="http://flashkit.com/tutorials/" frame="4" action="Press to go to the Tutorials section.">
</tutorials>
</flashkit>


I si por ejemplo en el atributo name de Flashmx añade ni que sea un 5 separado es decir con un espacio ya no encuentra nada.. hace rato que estoy mirando de solucionarlo pero nosé como...

Salu2 ;) y gracias por todas las ayudas que me podais aportar! :)

Por MaTaLaRaNyA

11 de clabLevel



Genero:Masculino  

Barcelona

firefox
Citar            
MensajeEscrito el 05 Abr 2005 03:11 pm
la verdad es que si llegas y posteas un código completo es muy difícil ayudarte, primero porque uno no lo hizo y segundo porque.. como que está un poco mal formado
lo mejor sería ir poniendo trace rutina tras rutina para ver qué cadenas llegan

Por fael

BOFH

2443 de clabLevel

3 tutoriales
2 articulos

 

firefox
Citar            
MensajeEscrito el 05 Abr 2005 03:38 pm
También podrías probar estos dos ejemplos que tengo yo hechos, a ver si te sirven.

http://www.elecash.org/blog/?p=53
http://www.elecash.org/blog/?p=33

El primero busca en una base de datos MySql, el segundo dentro de cajas de texto de Flash.

Cualquier duda la posteas aquí o en el blog, como prefieras.

Deu!! ^^

Por Elecash

Claber

8126 de clabLevel

37 tutoriales
19 articulos
13 ejemplos

  Bastard Operators From Hell Desarrollador de GAIA Premio_Secretos Héroes

BarnaCity

clabbrowser
Citar            
MensajeEscrito el 05 Abr 2005 06:05 pm
Merci voy a mirarmelo, mi idea es hacerlo con XML ayer pense que era impossible i encontrando este ejemplo he visto que si, haber si mirando tus ejemplos consigo solucionarlo, tu así a simple vista no ves donde podria estar el fallo? yo diria que me falta alto en actionscript...

Salu2 ;) y gracias :)

P.D: la idea en general era usar flash y XML solemente sin nada de php... ya que el server podria no soportarlo.

P.D: El problema no esta en crear el buscador sinó en poder enviar el resultado a un frame (Es decir a la sección que se encuentra). Esto ponerlo como esta hecho este script en vez de ser enlaces a una web, poner mi contenido fijo casi casi, i poder encontrar cualquier palabra i saber en que apartado de la web encontrarlo i hacer un enlace al frame o swf externo de la web.

Por MaTaLaRaNyA

11 de clabLevel



Genero:Masculino  

Barcelona

firefox
Citar            
MensajeEscrito el 06 Abr 2005 05:31 pm
Después de investigar creo que ya sé de donde viene el problema pero la verdad nosé como solucionarlo, haber si alguien me puede ayudar:

Código :

stop();
_root.nameBut.enabled = false;
//this is the function for the search engine
function searchSite() {
   flashSite = new XML();
   flashSite.load("url_flashkit_goto.xml");
   flashSite.onLoad = findSite;
   if (this.loaded) {
   headline = "Text loaded."
}else{
   headline = "Text not yet loaded."
}
   //with this function we will get access to the xml tree
   function findSite() {
      
      //"flashSite" contains the xml file
      for (var count01=0; count01 <= flashSite.childNodes.length; count01++) {
         if (this.childNodes[count01].nodeName.toLowerCase() == "flashkit") {
            flashkitContent = this.childNodes[count01];
            }
      }
      findUrl(flashkitContent);   
}
function findUrl(thisUrl) {
   for (var count02=0; count02<=thisUrl.childNodes.length; count02++) {
      //we are defining the var modelName here
      urlName = thisUrl.childNodes[count02].nodeName.toLowerCase();
      //the string from the input textfield is compared 
      //with the name of the childnodes
      if (searchWindow.toLowerCase() == urlName && urlName != undefined) {
         //if there is a match we do all this
         thisName = thisUrl.childNodes[count02].attributes.name;
         headline = thisUrl.childNodes[count02].attributes.action;
         urlText = thisUrl.childNodes[count02].attributes.myUrl;
         frameNumber = thisUrl.childNodes[count02].attributes.frame;
         //the button will appear..
         _root.nameBut.enabled = true;
         _root.nameBut._alpha = 50;
         //if there is no match...
         //we cannot use urlName here because this still holds more child node names
         //and this statement will always be executed, so we use thisName.
         //urlText is undefined: if the user presses the submit button w/o adding text
         //this will be executed if urlText is undefined.
      }else if (searchWindow.toLowerCase() != thisName.toLowerCase()  || urlText == undefined){
         //the button is disabled
         _root.nameBut.enabled = false;
         //the button will not appear
         _root.nameBut._alpha = 0;
         headline = "Sorry, no match.";
          }
        }
   }
}
//here we define the function for the button containing the frame number 
function myFrame(){
      gotoAndStop(frameNumber);
}
//here we define the function for the button containing the url and the 
//browser target window
function myUrl(){
      getURL(urlText,"_blank");
}


Aquí falla algo, ya que esto seria lo que habria de hacer para poder poner más contenidos.. digamos que más de una palabra una frase un texto entero.

<hola name="hola" myUrl="http://www.cristalab.com" frame="4" action="Ver más..."></hola>

En la etiqueta i en name deben ser la misma palabra, yo pense que cambiando solo el atributo name me funcionaria, pero también interviene la etiqueta... estoy encabezonao con esto haber si alguien me puede ayudar... estare trasteando con esto haber si lo consigo pero si alguien ve el problema.. a poderser digamelo.

Si quereis que os pase el script añadirme al msn... el script no es mio es de flashkit pero si quereis igualmente que os lo paso no tengo ningún inconveniente ;) .

Salu2 ;) y gracias de nuevo.

Por MaTaLaRaNyA

11 de clabLevel



Genero:Masculino  

Barcelona

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.