-
[RESOLVED] Search box issues
I created a search box for a flash website I created in CS4 using AS3. I am trying to link it to GoodSearch to pull up results from their search (for a non-profit organization). I created the input text field, a "Go" button and am using this script under Actions:
var link:URLRequest=new URLRequest("http://www.goodsearch.com/search.aspx?keywords=" + GoodSearchText.text);
SearchGoBtn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
navigateToURL(link);
}
When I type in some text in the field and click the Go button, the main page for GoodSearch is pulled up in a new window but no search is actually performed. I'm sure there is something I'm missing in my script but after searching the net for answers, I haven't found any. Can anyone please help me out with this?
-
Your URLRequest object is treating 'GoodSearch.text' as null, because that is the value when the application starts.
You need to give 'link' the right value when 'GoodSearch.text' is filled.
I've tried this, and it worked.
PHP Code:
import flash.events.MouseEvent;
import flash.net.URLRequest;
var link:URLRequest = new URLRequest ();
search.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent){
link.url = "http://www.goodsearch.com/search.aspx?keywords=" + GoodSearch.text;
navigateToURL(link);
}
-
Thank you very much for your help. It works like a charm. I spent so much time trying to figure out what I was missing but now I see. Again, it's much appreciated.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|