Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

marvi

sistema de busca em flash

Recommended Posts

Ola pessoal, tenho um sistema de busca em flash que chama um banco de dados xml para rodar em cdrom, mas meu busca ele não é tão preciso, por exemplo, quero pesquisar sobre macromedia flash 8 e se eu digitar só macromedia ele não chama a frase completa, como faço para ele considere todos os caracteres?

 

Abaixo segue o codigo do meu busca:

 

action script

stop(); fscommand("allowscale", "false");var dbArray = new Array();var dbXML = new XML();// handle xmldbXML.onLoad = function()   {	// variable init	var title, description, link, keywords;	var ndRoot = this.firstChild;		// loop throug the entire xml tree	for(var i = 0; i < ndRoot.childNodes.length; i++)	   {		// ignore white spaces		if(ndRoot.childNodes[i].nodeName != null)		   {			// get node attributes values			title = ndRoot.childNodes[i].attributes.title;			description = ndRoot.childNodes[i].attributes.description;			// loop throug the specific node 			for(var j = 0; j < ndRoot.childNodes[i].childNodes.length; j++)			   {				if(ndRoot.childNodes[i].childNodes[j].nodeName == "link")				   {					// get node value					link = ndRoot.childNodes[i].childNodes[j].firstChild.nodeValue;				}				else if(ndRoot.childNodes[i].childNodes[j].nodeName == "keywords")				   {					// get the keywords					keywords = ndRoot.childNodes[i].childNodes[j].firstChild.nodeValue.split("|");				}			}			dbArray.push(new _root.record(title, description, keywords, link));			// create a new instance of the -=record=- class with these informations		}	}}// record class constructorfunction record(title, description, keywords, link)   {	this.title = title	this.description = description;	this.keywords = keywords;	this.link = link;}// search functionfunction search(string)   {	// variable init	var nResults = 0;		for(var i = 0; i < dbArray.length; i++)	   {		// loop throug the keywords Array		for(j = 0; j < dbArray[i].keywords.length; j++)		   {			// check if the string matches with a keyword			if (dbArray[i].keywords[j].toLowerCase() == string)			   {				found = true; nResults++;				break;			}		}		if(found)		   {			// show the results...			results += "<b><a href=\""+ dbArray[i].link + "\"><u>" + dbArray[i].title + "</u></a></b>" + "<br>";			results += dbArray[i].description + "<br><br>";			found = false;		}	}	if(nResults == 0)	   {		// if no results...		results = "<b>No links found. Try again...</b>";	}	gotoAndStop(10);}// loed the xml filedbXML.load("database.xml");Selection.setFocus("word");

se quiser meu xml é:

<database>	<record title="flash 5" description="okCreate animated, vector-based Web content."><titulo>ok</titulo>	<link>http://www.macromedia.com/software/flash</link>	<keywords>Macromedia Flash 8|SWF|XML|Shockwave|ActionScript|ActionScripting</keywords>	</record>	<record title="Ultrashock" description="ok2The ultimate knowledge base for multimedia developers."><titulo>ok2</titulo>	<link>http://www.macromedia.com/software/flash</link>	<keywords>Ultrashock|Ultra Shock|Sources|Tutorials|Macromedia|Flash|SWF|Shockwave|ActionScript|ActionScripting</keywords>	</record>	<record title="Ack!" description="ok3ActionScript Component Kit"><titulo>ok3</titulo>	<link>http://chattyfig.figleaf.com/ack</link>	<keywords>ActionScript|Action Script|ActionScripting|XML|Components|Extensions|Widgets</keywords>	</record>	<record title="Flashcoders" description="ok4High traffic mailing list for programmers using Macromedia Flash 5. This list is run by Branden Hall of Fig Leaf Software."><titulo>ok4</titulo>	<link>http://chattyfig.figleaf.com/a</link>	<keywords>Flash|ActionScript|Action Script|ActionScripting|XML</keywords>	</record>	<record title="ActionScript: The Definitive Guide" description="ok5For web developers and web authors who want to go beyond simple Flash animations to create enhanced Flash-driven sites. Regardless of your level of programming expertise, this combination of ActionScript fundamentals, applications, and handy quick-reference will have you scripting like a pro."><titulo>ok5</titulo>	<link>http://www.oreilly.com/catalog/actscript/</link>	<keywords>Book|Books|Flash|ActionScript|Action Script|ActionScripting|XML</keywords>	</record>	<record title="Dreamweaver 4" description="ok6Make short work of Web site and HTML page production."><titulo>ok6</titulo>	<link>http://www.macromedia.com/software/dreamweaver</link>	<keywords>Macromedia|Dreamweaver|Flash|HTML|JavaScript|CSS|Editor|Webdesign</keywords>	</record>	<record title="Freehand 10" description="ok7Create vector-based illustrations for Flash and for print."><titulo>ok7</titulo>	<link>http://www.macromedia.com/software/freehand</link>	<keywords>Macromedia|Freehand|Flash|Illustration|Illustrator|DTP|Print|Design</keywords>	</record></database>

Preciso muito, se puderem me ajudar fico grato desde já!

 

Marcelo

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tava precisando fazer algo parecido e agora comecei a enteder, mas nesse ex eu vou criar um botao para fazer a busca e chamar a função de busca né, como faço isso, qual é a açao do botao buscar:on (release) { function search();}?????

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.