dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] Textbox to querystring

  1. #1
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305

    resolved [RESOLVED] Textbox to querystring

    Hello guys, it's been a while!! Can anyone shed some light on the following??

    I have a text box that has a score in it. I'm trying to pass the score in a query string when you click a button. for example http://www.thesween.com/score.aspx?score=125

    This is what I have so far..

    on(release){
    var score1 = int(_level0.score.text);
    getUrl("http://www.thesween.com/score.aspx?Score="+score1,"_parent");
    }

    I've also tried:

    on(release){
    var score1 = _level0.score.text;
    getUrl("http://www.thesween.com/score.aspx?Score="+score1,"_parent");
    }

    and..

    on(release){
    getUrl("http://www.thesween.com/score.aspx?Score=" & _level0.score.text,"_parent");
    }

    at best the string ends as 'http://www.thesween.com/score.aspx?Score='

    Can anyone help with adding the score to the end of the string please?
    Last edited by thesween; 11-29-2009 at 03:52 PM. Reason: AS1

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    on(release){
    var score1 = int(score.text);
    getUrl("http://www.thesween.com/score.aspx?Score="+score1);
    }

    Should do it. Use trace(scrore) to test that you are getting it

  3. #3
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Hi Bret, thankyou for your quick reply. Unfortunately, it still won't work. The score is in a dynamic text box, would that make a difference?

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Ok I'm having trouble getting the onClick or onRelease to work at all.
    I'm so accustomed to AS3 now it's hard to go back to AS1 coding.....
    Make sure your click is working using trace then go from there. Just adding the text should work as I showed so the problem is likely somewhere else.

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    All else fails send me the fun file

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Ah Trace doesn't work in AS1

    I just tested the following code

    mc1.onRelease=function(){
    txt2.text="http://www.thesween.com/score.aspx?Score="+txt1.text
    getUrl("http://www.thesween.com/score.aspx?Score="+txt1.text,"_new");
    }

    worked fine

    If you have current version you might consider switching to AS3. It's a little overwhelming at first but in the long run so much better and the code compiles smaller and faster.
    Last edited by blanius; 11-30-2009 at 09:42 PM.

  7. #7
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Hi Bret, thanks again mate.. I still had problems but then realised the problems stemmed from the export settings.. It was set to export v6 and backward compatability was checked.. I just checked include flash6 as components and its sorted...
    here's the code..

    mc6.onRelease=function(){
    getUrl("http://www.keamautomatics.co.uk/score.aspx?Score="+score,"_parent");
    }

    I always have problems that involve the export settings... time to go AS3 me thinks...

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