-
theSWEEN
[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
-
KoolMoves Moderator
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
-
theSWEEN
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?
-
KoolMoves Moderator
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.
-
KoolMoves Moderator
All else fails send me the fun file
-
KoolMoves Moderator
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.
-
theSWEEN
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|