FORUMS: list search recent posts

Search Bar Troubles

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
kstiles31
Search Bar Troubles
on Sep 6, 2007 at 12:52:32 pm

I am trying to create a google searchbox for a navbar on a website. The problem I am getting is when I execute a search, instead of searching for what is in the input text box it searches for:

"search criteria



*if i put "search criteria" in the text input field.

this is how the .fla is set up:

input text box with the var "q"
button with the actionscript:

on(release){
getURL("http://www.google.com/search","_blank","GET");
q = "";
}


any help will be much appreciated.


Return to posts index

kstiles31
Re: Search Bar Troubles
on Sep 7, 2007 at 3:39:02 pm

sorry, original post used the html...

what it searches google for is:

<text format leading="-3"><p align="left"><font face="_sans" size="12" color="000000" letterspacing="0" kerning="0">seach criteria</font></p><textformat>

pretty much, instead of searching for the text is put into the input text field, it searches for all of the tags and everything

hope that is more clear...


Return to posts index

Doccie
Re: Search Bar Troubles
on Sep 7, 2007 at 5:01:45 pm

In that case, try to add the %22 around the Q message. So... q = "%22" + q + "%22";
and then send it.



Return to posts index


kstiles31
Re: Search Bar Troubles
on Sep 7, 2007 at 7:28:51 pm

i understand what you are saying but here is the thing that just blows my mind...

if i create a new flash doc;

create a circle shape, convert it to a button, then in the buttons actions type:

on(release){
getURL="http://www.google.com/search","_blank","GET");
q = "";
}

then create a input text box and set the var to q...

it works fine...

it doesnt work it the var is anything but "q"

so my questions is how does this work without me ever telling the button to search for the info in the text field and if i can do this in a new flash doc in 10 seconds, why doesnt it work the the other flash doc with other buttons and stuff in it?

i have tried so many things...


Return to posts index

Doccie
Re: Search Bar Troubles
on Sep 7, 2007 at 7:38:48 pm

what getURL does is go to the specified webpage -and- sending along all the variables that are on the current timeline from where the getURL action has been issued.

If you'd look at a query from google, you would see something like this:

http://www.google.com/search?client=opera&rls=en&q=query&sourceid=opera&ie=...

If we break that down into bits and pieces you get this:
http://www.google.com/search (the url you have accessed using getURL.
client=opera (this is just information about the browser that is added automatically)
q=query (this is your actual Query, since you gave the textfield a variable name of Q, flash sends this variable to Google, thus producing something that looks like http://www.google.com/search?q=mySearch

If you're gonna put that in another movie filled with other variables, flash will send these along too, and my guess is that Google blocks your query because it has received invalid GET variables.



Return to posts index

kstiles31
Re: Search Bar Troubles
on Sep 9, 2007 at 9:37:05 pm

thank you for the help.

i dont know why i didnt try this sooner, but i created a new movie clip, added the button and text box there, then put that clip on the main scene... works great...

again, thanks...


Return to posts index


Doccie
Re: Search Bar Troubles
on Sep 7, 2007 at 4:55:11 pm

You'll need to url encode your q variable before sending it off to google. Unfortunately, flash does not have a built-in url encode function, but it shouldn't be to hard to create. Just replace every occurance of '"' with '%22' before you use the getURL.

Keep in mind that other characters may need to be urlencoded as well for your search app to work properly under all circumstances.



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]