A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Search box issues

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    3

    resolved [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?

  2. #2
    Member
    Join Date
    Oct 2010
    Posts
    55
    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.CLICKonClick);

    function 
    onClick(e:MouseEvent){
        
    link.url "http://www.goodsearch.com/search.aspx?keywords=" GoodSearch.text;
        
    navigateToURL(link);


  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    3

    Thumbs up

    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.

  4. #4
    Member
    Join Date
    Oct 2010
    Posts
    55
    glad I could help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center