Skip to main content
Inspiring
September 29, 2006
Question

Making a "search" box...

  • September 29, 2006
  • 41 replies
  • 2375 views
Okay, let's say I have an XML file like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<pages>
<page url="01.swf" search="one" />
<page url="02.swf" search="two,2" />
<page url="03.swf" search="three,3,tres" />
</pages>


Then, in Flash, I have loaded the XML file into a "navXML" variable, thereby "two,2" would be the value of "navXML.firstChild.childNodes[1].attributes.search", for example...

Making sense so far? - good!...

I want to make a search box. Basically a text entry box (say, "search_txt") that when a MC is pressed (say, "search_mc"), it will take the text in the search box and check to see if that text falls into any of the "search" attributes of that XML file....

I know this would involve a "for" loop, and I'm sure I'd have to first somehow parse the data in the "search" attributes by a "," (since some of the "search" attributes have more than one value), and maybe put them into an Array or something?...

I dunno - I know that this is a lot of questions at once, but I just wanted to give out my whole scenario so that hopefully someone could give me some idea of how to get started. Like, if my thinking is correct (above), then I suppose my first question would be how to get the "search" data paresed out by the "," and into Arrays?...

(or, maybe I'm WAY off base, and someone has made a better version of this that they can share!)

Thanks!...
This topic has been closed for replies.

41 replies

Participating Frequently
September 29, 2006
I did not test this but you could start with something like this and probably optimize it for speed.



Tim