Making a "search" box...

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!...

"TimSymons" <[email protected]> wrote in
message
news:[email protected]...
>I did not test this but you could start with something
like this and
>probably
> optimize it for speed.
>
>
>
> Tim
>
>
>
>
> // search_txt, search_mc already exist on timeline
> //
> // assume also that the following XML data was
read/parsed into the navXML
> variable:
> /*
> <?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>
> */
>
> search_mc.onRelease = searchXML;
>
> function searchXML():XMLNode {
> var searchStr:String = search_txt.text.toLowerCase();
> var i:Number;
> var j:Number;
> var nodeIndex:Number;
>
> for (i=0; i<navXML.firstChild.childNodes.length; i++)
> var searchArr:Array = new Array();
> searchArr =
> String(navXML.firstChild.childNodes
.attributes.search).split(",");
> for (j=0; j<searchArr.length; j++) {
> if (searchStr == searchArr[j].toLowerCase()) {
> nodeIndex = i;
> break;
> }
> }
> if (nodeIndex != undefined) {
> break;
> }
> }
>
> return navXML.firstChild.childNodes[nodeIndex];
> }
>
Couple things here. I am not sure what you are returning to?
search_mc is
a MovieClip, so you are returning a Node to the onRelease?
Think that may
be a typo.
As far as speed... couple things. I am not sure about
actionscript and its
lookup times for executions like this... but, first things
first.
You actually don't need to break up the string into other
words. Thanks to
the indexOf method of the String Class. You can just do a
test
if (yoursearchValue.indexOf(searchWord) > -1) {
found it
I also think you may be better served parsing your XML into a
native Flash
Datatype like an Array of Object like this:
myFinisedObject = [{url:"01.swf", keywords:"one"},
{url:"02.swf",
keywords:"two,2"}]
To build that Array you could do the loop like listed in the
previous reply.
Then when you do your search you would just loop this array
of objects
checking for the indexOf on the keywords property.
I also think it depends on how much data you are going to be
handling here.
The parsing into the myFinisedObject gets better the more
stuff you give it
I think (again I am not sure how fast it is in comparison -
but if you try
it, let me know)

Similar Messages

  • Who Decided to Combine the Search Box and Address Bar?

    A very wise person once said:
    "Make everything as simple as possible, but no simpler!"
    That fundamental rule of design has been volated with Internet Explorer 9.
    I've been using IE9 for about a month now, trying to get used to all the new things.  Performance-wise it's nice, and the changes to security are welcome.  Okay, so the color-management is half baked, and it still has its problems, but I guess
    it's an improvement.
    But what idiot decided to make the search box and the address field one and the same?
    You think I'm being petty?  Go try to research what a particular file is - for example, go see if you can find info on "bib.dll".
    It wants to make it into a URL.  It's not a URL.  It may LOOK like one, but it's a name, honest! 
    Putting quotes around it doesn't help.  Maybe I'm missing the advanced syntax it takes to get such a thing to be a search term instead of a URL. Even if so, how is this an improvement or simplification?  It's certainly not intuitively obvious how
    to force a search, short of dredging up a link to Google and typing info in there directly.
    Doing a search and typing in an address are two FUNDAMENTALLY DIFFERENT THINGS.
    And hey, it's not a big deal that you can no longer see what it was you searched for, and maybe even edit it and search again.  No, because now the search engine pages have to waste space to put up a box showing what you just searched for, since it's
    now GONE out of the address field.
    How does stuff like this pass a design review?
    And to think the Microsoft Engineers worked extra hard to take it out.
    You Engineers at Microsoft need to take the product back from your moronic marketing people and make it actually work right.
    -Noel

    Ed, with 36 years software engineering experience, I know the difference between the difficulty of adapting to change and when something just isn't right.
    This isn't right.  Ever hear the phrase "apples and oranges" to describe two things that don't go together?  That concept fits well here.
    You say that thinking along the lines of "you no longer had to think about which box you want to type into" helped justify the change. 
    Is there something wrong with thinking?  This is akin to saying, "you no longer had to think about which nozzle at the gas station to fill your tank from". 
    Diesel doesn't work in a gas engine.  Nor does the water from the garden hose.
    You say "both methods of typing work in the one box".  But they don't, logically!  Did you actually read this thread? 
    Is there something wrong with logic?
    Alas, what the simple users of the general public want and what experienced computer users need are clearly two different things, and it's clear looking back that this move simply marked another step in Microsoft's clear intent
    to walk away from making serious computer operating systems that actually
    work.  Windows 8 is testament to that (and don't tell me you haven't noticed all the negative response).  Other such things include Windows Search - which is designed to be unable to actually do an exhaustive search...  Even going
    back as far as hiding file extensions by default.  And don't get me started on the use of telemetry to justify deprecating such things as Windows Backup.
    Do you understand the difference between leading and following?  Which, as a concept, would you say is better?  You need to stay the hell away from trying to emulate what Google does.  You can do better!  If you want a different
    example, follow Firefox - it still has a search box.  Even Apple - known for dumbing things down to the level of the family dog - stil puts a search box in Safari.
    I don't mean to be critical of your response, Ed, but this is a good example of "the operation was a success but the patient died".
    Thank goodness there are 3rd party developers who are struggling to put back functionality Microsoft keeps removing.  But then Microsoft removes the APIs they use.  That's not going to keep!
    P.S., Watch the film "Idiocracy" some time.
    -Noel
    Detailed how-to in my eBooks:  
    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

  • Is there a way to have search box items open in a new tab?

    is there a way to have Safari open searches (from the search box next to the address bar) in a new tab, rather than overwriting the existing one?
    I'm guessing the answer to this is "not until someone makes an extension...", but thought I'd ask...

    If you're typing in the full search term(s) rather than using their suggestions/recent... you can hold the command key when hitting enter, and the results will open in a new tab. Hold command & shift to make the new tab active.
    Command-option does the same thing, but in a new window - again with shift making it active.

  • Help with creating a search box

    Lo,
    I am making a website using dreamweaver 8 and was wondering
    if anyone could help me in making a simple search box. If your
    wondering what i mean when i say search box, i mean a text field
    where you can enter a search subject and a button to submit the
    search. Not unlike the search areas you see on most popular
    websites. So far I've been able to make the text field and button
    but i am having trouble with scripting them so that they actually
    preform a search. I'm guessing that I will have to make a new page
    that to display search results, but other that that i'm pretty much
    in the dark about how to go about it. Anyone who could help me out
    or show me where I could get help, I would really appriciate
    it!

    Thats a good one Nancy, might look into that for an upcoming
    client.
    Atomz have one as well, customizable too.
    Brendon
    "Nancy O" <[email protected]> wrote in
    message
    news:eripkt$kgc$[email protected]..
    >
    http://www.freefind.com/
    >
    > Very customizable. Free version has ads. If you're
    willing to pay a
    > dime,
    > no ads. Allows you to select which pages get indexed,
    incl's PDFs and
    > other
    > great features. Search web or just your site. After you
    sign up and
    > paste
    > their code into your pages, it takes about 48 hours to
    spider and index
    > your
    > site for full search.
    >
    > If you don't like that one, there's always Google....
    >
    > HTH,
    > Nancy O.
    >
    >
    >
    >
    >
    >
    > "lotan666" <[email protected]> wrote in
    message
    > news:eriok7$jbt$[email protected]..
    >> Lo,
    >> I am making a website using dreamweaver 8 and was
    wondering if anyone
    > could
    >> help me in making a simple search box. If your
    wondering what i mean when
    > i say
    >> search box, i mean a text field where you can enter
    a search subject and
    >> a
    >> button to submit the search. Not unlike the search
    areas you see on most
    >> popular websites. So far I've been able to make the
    text field and button
    > but i
    >> am having trouble with scripting them so that they
    actually preform a
    > search.
    >> I'm guessing that I will have to make a new page
    that to display search
    >> results, but other that that i'm pretty much in the
    dark about how to go
    > about
    >> it. Anyone who could help me out or show me where I
    could get help, I
    > would
    >> really appriciate it!
    >>
    >
    >

  • Is it possible to have one search box search many fields? ( and "autocomplete" the results)?

    I'm really new to the whole area of JSON, autocomplete and javascript. My first project in this area is personal: making it easier to search for wines in my wine cellar.
    I have all my wines in a sqlite database (driven by CF 9 of course) and have a nice UI to report on, add, modify, delete, etc.  What I want to add is a search capability that works like this:  a user types text in a search box in any order they want and automagically, the wine is found. 
    To be specific, a user could start with "2005 Caymus" and the area below the text search box would be populated with all of the varietals of Caymus for 2005 that are in the cellar.   Similarly the user might start the search by typing "2005 Cabernet" in which case anything in the cellar that is from 2005 and a Cabernet Sauvignon or a Cabernet Franc from all wineries would appear below the text box. Or maybe they just want to see what French wines are in the cellar, so they'd start their search with "France" or "French". (BTW,  winery, vintage, wine type (varietal), country, appellation, etc. are all separate fields in the database/table.)
    Is my imagined search capability possible, or does each aspect of the search (year, winery, wine type/varietal) have to be user-entered into a separate text box?
    Any guidance/answers greatly appreciated!  If you're local, might even be worth sharing a vintage bottle of wine!

    Sorry I was unclear.
    Google is a single text box.  If you type "coldfusion 9 new features"
    you get a good listing of your results without having one box for
    software one for version one for descriptor and
    one for topic .  Similarly with Google it's likely you'll get
    somewhat similar results typing in "new features coldfusion 9" or
    "coldfusion 9 features".  So for my wine app I just want to present the
    user with one box so they can type in "Caymus 2005 Cabernet Sauvignon"
    (a "specific" search) or "2005" (a search for all wines from that year),
    etc.  It's the cleanness of the user experience I'm trying to
    accommodate here.    Make sense?

  • Customizing Advanced Search Box

    We have a SharePoint 2010 farm. Some users complain that they have difficulty in finding documents. They get many results back and so have a hard time in searching for what they are looking for. Users search documents using Advanced Search box.
    I am thinking of adding scopes so that users users will only see relevant information i.e. documents specific to their site. Is there anything else I can do to make their search experience more effective and rewarding? Thanks a lot.
    Mayank

    Hi Mayank, 
    I blogged about making modifications to the advanced search webpart (to make it a little more user friendly), here: http://matthewyarlett.blogspot.com.au/2013/10/customising-sharepoint-advanced-search.html
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • Windows 10 9926 Bug Search field not allow text do not allow me to type anything in search box and wont allow to click start menu

    Seems everything else is fine.
    But I cant click the search box it just marks the Search the web and Windows  but wont allow me to type anything.
    And the same for the start menu if I click the windows icon in lower left corner nothing happens.
    Please someone help

    Hi,
    Generally speaking, this problem can be caused by system store componments lost or corrupt. Dism command below should be helpful to resolve this problem:
    DISM /Online /Cleanup-Image /RestoreHealth
    Roger Lu
    TechNet Community Support
    SFC /scannow & DISM are broken in 9926 they do not normally complete making things e en more difficult to diagnose.
    Wanikiya and Dyami--Team Zigzag

  • cfinput search box and submit button

    So I'm doing a search box with a submit button
    I'd like it to be intuitive by having the words "search..." inside it by default
    how do I make "search..." disappear when the user clicks on the box ?
    is there any preference to post or get ?

    If it's a search box though, making it a get probably makes sense: it doesn't change the system so it's not really a POST sort of operation, plus the punter can bookmark the search (results) URL which is quite handy.
    Google uses a GET, for example.
    But there's no hard-and-fast rule, obviously
    As for the original question: this is really a client-side question, not a CF question (despite using <cfinput>).  As someone else suggested, read up on HTML and probably the JavaScript event model.
    Adam

  • Logical AND not working in the forum search box

    Logical AND of search terms does not seem to be working in the MSDN forum search box. Example: I go to the Project Customization and Program forum and type the word
    subproject
    in the search box. I get a lot of hits. So now I try to reduce the number of hits by typing
    subproject AND read
    Surprisingly, I now get MORE hits than before.   The same thing happens if I enter
    subproject & read
    Do the MSDN forums not support the standard logical AND combinations of search terms?  If they do support these combinations, what is the syntax?
    Jim
    ...Jim Black

    Cheers, you're welcome.
    There's a thread going in the Suggestions forum with plenty more requests for updates to the search tool. You may want to add your voice there too:
    http://social.technet.microsoft.com/Forums/en-US/9cf8ad4b-5111-4f84-9809-99cd8f1b7152/make-the-forum-search-tool-useful?forum=suggest
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • Url does not show up in address bar...and when i type in a search box, the cursor jumps up to the address bar automatically

    I'm not sure what happened. However, I can never see the URL in the address bar anymore.
    I go from page to page, and the URL shows only for a split second, then disappers.
    All the address bar says is "Search or enter address"
    I copy and paste a lot of URL links for work, so this makes it very painful and a hassle now.
    Where now i need to go back, right click on a link, and do "copy link location".
    Where as i used to just go up to the address bar and copy the URL.
    Also, I notice now when I start typing on certain search boxes.
    The cursor automatically jumps to the URL address bar as soon as I start typing. Which is really annoying.
    It will only do it once it seems....but its annoying when i try to type a search...only to see that i've been typing in the URL address box cus it jumped up there.
    PLEASE HELP!!!!

    Try some basic troubleshooting.
    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings, disables most add-ons (extensions and themes).
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu:
    *In Firefox 29.0 and above, click the menu button [[Image:New Fx Menu]], click Help [[Image:Help-29]] and select ''Restart with Add-ons Disabled''.
    *In previous Firefox versions, click on the Firefox button at the top left of the Firefox window and click on ''Help'' (or click on ''Help'' in the Menu bar, if you don't have a Firefox button) then click on ''Restart with Add-ons Disabled''.
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    When the Firefox Safe Mode window appears, select "Start in Safe Mode".<br>
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.

  • Set the Finder's Search Box default to current folder? How?

    How do I set the the Finder's default Search Box parameters to be the current folder that I'm in, instead of searching the whole flamin' computer? (I have to quickly click on the folder name) And also instead of the default being 'Contents', how can I set it to be 'File Name'? It would speed up so many of my searches. I could still click on 'This Mac' to get that, and 'Contents' likewise.
    Tks in advance
    Drew

    I complitely agree and very very frustrated with that problem too just wrote this to feedback system:
    The problem that many people find is that when you have a finder windows open and that you browse a file like "Appplication" then due to the large number of application you use the search bar by taping the application name.
    That's where the problem come from.
    Once you tape the application name it start searching in the all computer ! instated of in the file
    The second problem is that he is searching the content and it will be better to have as default by file name.
    If i wanted to do that kind of search i will use the spolight button next to the clock and people want that search bar in finder to be searching in the folder you are in not all computer.
    Last problem is that we don't have a custom option in spotlight preference or finder preference.
    I would recommend to have that default search in finder change to search in file ONLY and to add Spotlight option in the Finder Preference for people to be able of customizing it.
    When you use that search bar everyday many times a day it becomes very very frustrating.

  • Search box not displaying correctly in Safari

    How can the search bar on the Apple site not display correctly in Safari? I find this odd that Apple would allow this. It displays like 2 search boxes overlapping each other. It still functions correctly but it is a little embarrassing since I am always bashing windows pro browser display.

    Hi
    Welcome to Apple Discussions
    Might be a corrupted cache or cookies issue. First, go to Safari Preferences>Security>Show Cookies. Type Apple in the Spotlight panel. Highlight/remove the cookies. Then, go to the Safari Menu>Empty Cache. Try the Apple site.
    If the double search panel still appears, go to the Finder: Your User Account>Library>Caches. There, move to the trash the com.apple.safari file. Restart Safari and try the Apple site again.
    Post back

  • SharePoint Server 2013 Search Box has disappeared

    Hi guys,
    SharePoint Server 2013 Search Box has disappeared and not showing on any sites. Even when I try to go to Search centre site I get an error "sorry something went wrong...
    Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator. "
    My search SA is working fine and crawl running with no error. It seems like there was same issue on SP foundation 2013 where there is fixed released for that:
    https://support.microsoft.com/kb/2760625?wa=wsignin1.0
    But I have SP Server and i can confirm that I have installed SP1 (KB288055) in my farm.
    I wonder if I need to install any CU to fix this.... I haven't installed any CUs in my farm yet.
    Shall I go for Feb 2015 CU update or Sept 2014 CU? or is there any fixes for that with no CU or I need to install my farm from the scratch....
    Please help.
    Any advice greatly appreciated.
    BalaiP 

    You have deactivated SharePoint Search from center Admin. 
    Please activate it 
    Regards, Sachin

  • List search box does not work for some users Sharepoint 2013

    Hello,
    I have a list for which I've enabled a search box (from web part settings, miscellaneous).
    The problem is that for me and the others admins the search works perfectly, but for the other users who have only Read
    privilege the search doesn't work and shows the loading icon forever.
    Why does this happen?
    How can I enable search box
    for the list for all users?
    Please help
    me

    Hi,
    For troubleshooting your issue, please go to Central Administration -> Application Management ->Manage Service applications->  select search service application -> click Permissions -> add "Everyone" with Full Control.
    Best Regards,
    Eric           
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to get rid of the stupid drop down box in the search box

    Thank-you for the help. I am not sure if I put this is the right spot or not, but I wanted to take the time to say thank-you to the people who answered :
    "Chosen solution
    If you want to restore the previously used standalone window to manage search engines then you can toggle this pref to false with a middle-click on the about:config page.
    about:config page: browser.search.showOneOffButtons = false
    Close and restart Firefox to the change effective. "
    I LOVE Firefox but it is so frustrating when I can't just right click and "paste and search"
    i have to do A LOT of searching for work and I had to switch to chrome for a few days until I found this solution because the new search box messed with our internal software (sorry I would tell you more but I don't really understand computers that much, but I am so glad to have my old friendly fox back!!!)... Thanks guys, Brit

    thanks for the feedback - since your question doesn't really contain any other request for support, i'm going to close the thread...

Maybe you are looking for