05-27-2002, 07:53 PM
|
#1
|
|
Registered User
Join Date: May 2002
Posts: 16
|
Flash to Javascript
Hello,
I have a little problem. I have a button in Flash called "Save Scores" that will do two things when it is clicked: save a score into a cookie and get the updated number of scores from the cookie.
Here's the problem. If I have only the line "getURL("javascript:SaveScore( '" .....);" this works fine.
If I have only the line "getURL("javascript:GetRecordNum()");" this works fine.
But if I have both of them together in the button, like below, then it doesn't work. It doesn't save the score, and it doesn't get the number of scores.
Does anyone know what the problem is?
Thank you very much in advance.
on(release)
{
getURL("javascript:SaveScore( '" + _root.name.name + "','" + scoreCount + "', '" + timeSpent + "') ");
getURL("javascript:GetRecordNum()");
gotoAndPlay(81);
}
|
|
|
05-28-2002, 01:04 PM
|
#2
|
|
ActionScript.org Founder
Join Date: Nov 2000
Location: New York
Posts: 8,736
|
Simplest solutions often being the ones that work I'm inclined to think that since you haven't terminated your JS calls with a semi-colon, that could be stuffing you up. Try:
ActionScript Code:
getURL("javascript:SaveScore( '" + _root.name.name + "','" + scoreCount + "', '" + timeSpent + "');");
getURL("javascript:GetRecordNum();");
__________________
Cheers
Jesse Stratford
ActionScript.org Cofounder
Please don't email or PM me Flash questions, that's what the Forums are for!
Please don't rely on me reading my PMs either. Email me about important stuff.
|
|
|
05-28-2002, 03:00 PM
|
#3
|
|
Registered User
Join Date: May 2002
Posts: 16
|
Hmmm, I tried that and it didn't work. I fooled around for a bit and found a run-about way that did make it work. I made another movie clip and called it functions. On frame one, I put the actionscript
getURL("javascript:SaveScore('" + _root.name.name + "','" + scoreCount + "', '" + timeSpent + "');");
and on frame 20, I put the actionscript
getURL("javascript:GetRecordNum();"); .
So I just call the movie clip and make it run from frame 1 to 20. And that worked! Really odd.
|
|
|
05-28-2002, 03:18 PM
|
#4
|
|
ActionScript.org Founder
Join Date: Nov 2000
Location: New York
Posts: 8,736
|
Sure you're variables are all setup properly? Maybe you're passing a dummy value and causing one script to hang or something...
__________________
Cheers
Jesse Stratford
ActionScript.org Cofounder
Please don't email or PM me Flash questions, that's what the Forums are for!
Please don't rely on me reading my PMs either. Email me about important stuff.
|
|
|
05-28-2002, 03:21 PM
|
#5
|
|
Registered User
Join Date: May 2002
Posts: 16
|
I was playing around with the code some more and discovered something interesting. If I do only one getURL statement that calls both functions inside it, then it works! Like the following:
getURL("javascript: function1('my variables'); function2('my other variables');");
So I guess Flash doesn't like it if you call more than one getURL statements? Anyway, I really appreciate your help :-)
|
|
|
05-28-2002, 06:23 PM
|
#6
|
|
Worldkit Vote Holder
Join Date: May 2002
Location: Miami - USA
Posts: 816
|
This was a real nice thread to read...
Informative.
__________________
Cordially,
Abelius
Commuting between Birmingham, AL, Miami, FL and Beijing, China
http://www.worldkit.com
|
|
|
05-28-2002, 11:21 PM
|
#7
|
|
ActionScript.org Founder
Join Date: Nov 2000
Location: New York
Posts: 8,736
|
Hrmm I should have thought to suggest just one line. Getting slow in my old age
__________________
Cheers
Jesse Stratford
ActionScript.org Cofounder
Please don't email or PM me Flash questions, that's what the Forums are for!
Please don't rely on me reading my PMs either. Email me about important stuff.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 05:55 AM.
///
|
|