-
Hi-score PHP/mysql in Flash. Question
I'm ready to add a hi-score table that uploads to a website using mysql, for a little game. I turned to the old tutorial on the tutorial page again since I'm not all up on PHP and some of the required events in mmf2.
But then I realised it needs a few extentions that may not be compatible with the flash export.
Is there a tutorial available that could explain a good setup for Falsh?
-
Re: Hi-score PHP/mysql in Flash. Question
You can use the Get object in Flash with much the same theory as the older PHP/SQL tutorials - note that (I think) you can only access PHP scripts in the same domain as where the Flash file is placed, but otherwise the process is the same.
Which object does the tutorial you're looking as use? If it's Live Receiver, then the actions are virtually the same - if it's Moosock, replace all the HTTP request gubbins with just a simple "Download from [this URL]" action.
-
Re: Hi-score PHP/mysql in Flash. Question
Thank you for that, David. Yes Jamie just mentioned Get object in click chat too, I hadn't used the object before and it sounds very useful.
The tutorial asks for Live reciever, String Tokenizer, URL Encoder and String Parser 2.
Get object covers Live reciever and I'm guessing URL encoder.
String Parser 2 should be covered by the String Parser included.
Shweet!
-
Re: Hi-score PHP/mysql in Flash. Question
Quote:
Originally Posted by DavidN
...note that (I think) you can only access PHP scripts in the same domain as where the Flash file is placed, but otherwise the process is the same.
Read this:
http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html
I haven't tried it yet, but it seems that you can just upload a policy file to the same domain as you swf that allows it to access domains outside of it's own.
The file is named "crossdomain.xml" and has this formatting:
Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="example.com" />
</cross-domain-policy>
Just upload it to the root of the domain the swf is hosted from.
-
Re: Hi-score PHP/mysql in Flash. Question
Oh I see so it's the flash file that has the issue there, I was thinking it was facebook.
Cheers for that info!
-
Re: Hi-score PHP/mysql in Flash. Question
Dumb question, where can i find this "old" tutorial that is mentioned here?
-
Re: Hi-score PHP/mysql in Flash. Question
find it here: http://www.clickteam.com/website/usa/tutorials
Under "Advanced tutorials" called "Online Scores using PHP/mySQL"
-
Re: Hi-score PHP/mysql in Flash. Question
-
Re: Hi-score PHP/mysql in Flash. Question
That's an interesting find, UrbanMonk... if that works for people with the right access to their own webservers, then it would mean you could have one central high score/save table for your game and then distribute it around Flash sites like mad :)
-
Re: Hi-score PHP/mysql in Flash. Question
Quote:
Originally Posted by DavidN
That's an interesting find, UrbanMonk... if that works for people with the right access to their own webservers, then it would mean you could have one central high score/save table for your game and then distribute it around Flash sites like mad :)
Oh yes, just very much on my wish list!
-
2 Attachment(s)
Re: Hi-score PHP/mysql in Flash. Question
I edited clickteam's tutorial to work with the get object & flash. It didn't take long, but this hopefully will save some people the time.
-
Re: Hi-score PHP/mysql in Flash. Question
Nice work -- Do you mind if I add it to the ZIP or put it with the tutorial files somehow?
-
Re: Hi-score PHP/mysql in Flash. Question
Quote:
Originally Posted by DavidN
That's an interesting find, UrbanMonk... if that works for people with the right access to their own webservers, then it would mean you could have one central high score/save table for your game and then distribute it around Flash sites like mad :)
They would still have to add that file to their servers themselves, but at least it's possible.
If Clickteam added support for the mochi-score system then we wouldn't have to worry about that.
-
Re: Hi-score PHP/mysql in Flash. Question
Yes Mochi-media and other "flash" systems that offer the score boards will be a good option when they can be worked on but there are always people who want to do these things themselves.
-
Re: Hi-score PHP/mysql in Flash. Question
Jeff, feel free to add it to your Easy Score System Tutorial. You can just add the frame to your existing .mfa tutorial. It uses the existing php files found in that tutorial's zip.
-
Re: Hi-score PHP/mysql in Flash. Question
Quote:
Originally Posted by Jeff
Yes Mochi-media and other "flash" systems that offer the score boards will be a good option when they can be worked on but there are always people who want to do these things themselves.
Just to delve into that a tad more, having the ability to use more of the mochi services would open to automated social media and mochicoins for microtransactions; More monetizing oportunities.
-
Re: Hi-score PHP/mysql in Flash. Question
Where can I get "get.mfx"?
-
Re: Hi-score PHP/mysql in Flash. Question
http://www.aquadasoft.com/downloads.php
Took me a little while to find it too. :)
-
Re: Hi-score PHP/mysql in Flash. Question
Hi gnadegames ;
thanks a lot for this tutorial !! I was about to ask Jeff if he could update his online highscore tutorial....so thanks for sharing.
Eric
-
Re: Hi-score PHP/mysql in Flash. Question
One final piece of the Flash Hi score system is having a cross domain policy xml file on your domain so that new grounds and other flash portals will be allowed to submit high scores to your SQL database. A simple Cross Domain policy that allows any domain to submit scores is:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="true" />
</cross-domain-policy>
simply cut and paste the code above into notepad and save it as an .xml and upload it to your domain.
-
Re: Hi-score PHP/mysql in Flash. Question
That is awesome information, thanks!
May I ask; does the .xml need to named anything in particular?
-
Re: Hi-score PHP/mysql in Flash. Question
Quote:
Originally Posted by UrbanMonk
Quote:
Originally Posted by DavidN
...note that (I think) you can only access PHP scripts in the same domain as where the Flash file is placed, but otherwise the process is the same.
Read this:
http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html
I haven't tried it yet, but it seems that you can just upload a policy file to the same domain as you swf that allows it to access domains outside of it's own.
The file is named "crossdomain.xml" and has this formatting:
Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="example.com" />
</cross-domain-policy>
Just upload it to the root of the domain the swf is hosted from.
Like I said on page one it's named: "crossdomain.xml"
-
Re: Hi-score PHP/mysql in Flash. Question
Oh right, I actually though that was for something different. Double awesome!
-
Re: Hi-score PHP/mysql in Flash. Question
also make sure to but it in your root domain i.e www.domain.com/crossdomain.xml
-
Re: Hi-score PHP/mysql in Flash. Question
wow that actually worked :D
-
Re: Hi-score PHP/mysql in Flash. Question
Hmm, I've uploaded a game to newgrounds and the crossdomain.xml file doesn't seem to be working; submitting score to the database
Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.kongregate.com" />
<allow-access-from domain="*.kongregate.com" />
<allow-access-from domain="www.kongregate.com/*" />
<allow-access-from domain="www.newgrounds.com" />
<allow-access-from domain="*.newgrounds.com" />
<allow-access-from domain="www.newgrounds.com/*" />
</cross-domain-policy>
Is this how it should look?
I have placed it in the root of my domain where the index.html file resides for example.
-
Re: Hi-score PHP/mysql in Flash. Question
Quote:
Originally Posted by ionside
Hmm, I've uploaded a game to newgrounds and the crossdomain.xml file doesn't seem to be working; submitting score to the database
Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.kongregate.com" />
<allow-access-from domain="*.kongregate.com" />
<allow-access-from domain="www.kongregate.com/*" />
<allow-access-from domain="www.newgrounds.com" />
<allow-access-from domain="*.newgrounds.com" />
<allow-access-from domain="www.newgrounds.com/*" />
</cross-domain-policy>
Is this how it should look?
I have placed it in the root of my domain where the index.html file resides for example.
Why not this?
Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
-
Re: Hi-score PHP/mysql in Flash. Question
Thanks, LB. I've changed it to that, unfortunately still doesn't work. must be something else causing the issue, but I couldn't begin to think what as the highscore recieves fine otherwise.
-
Re: Hi-score PHP/mysql in Flash. Question
hmm, it works for me.
I dunno,
Did you try uploading the flash file to your domain and running it from there?
I'll assume when you say that it "receives fine otherwise" that you are referring to when it's being tested in mmf.
Are you using any kind of security in your php file? Could you make a test php file like this:
<?php
echo "Testing";
?>
And see if that works?
-
Re: Hi-score PHP/mysql in Flash. Question
Thanks for your help, UrbanMonk. But...
It now works! I changed it to LB's recommendation and it didn't work straight away, but now seems to be doing beautifully! I just needed to give it time to ponder and reflect I guess.
I'm so happy.
-
Re: Hi-score PHP/mysql in Flash. Question
Just tested the Get object in flash with this crossdomain spec and everything worked beautifully! The Get object is indeed very fast and communicating with the database via php was swift. Very useful for many purposes.
-
Re: Hi-score PHP/mysql in Flash. Question
Hello everyone
how is the database for the online scores?
thx
-
Re: Hi-score PHP/mysql in Flash. Question
can't understand your question.
-
Re: Hi-score PHP/mysql in Flash. Question
how is the database ?
CREATE TABLE `player_names` (
`name` VARCHAR( 25 ) NOT NULL ,
`score` INT( 20 ) NOT NULL ,
`date` DATE NOT NULL ,
PRIMARY KEY ( `name` )
) ENGINE = MYISAM ;
like this?
not easy when you do not speak English :)
ops sorry I have my answer !
"CREATE TABLE `name` (`id` int(11) NOT NULL auto_increment,`gameid` varchar(255) NOT NULL,`playername` varchar(255) NOT NULL,`score` int(255) NOT NULL,`scoredate` varchar(255) NOT NULL,`md5` varchar(255) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;"
-
Re: Hi-score PHP/mysql in Flash. Question
That's a terrible schema, so many varchars...
-
I am doing the tutorial on the online high scores. When I open it it says there is an error and that I need to get the GET.MFX for this to work. From reading these posts does this mean I need to purchase the Flash extension in order to do this?
I belong to bluehost. I wonder if they will accept MMF en tensions or does it have to be flash?
-
Well yes and no
You do need the get object which you can download for free but if you want to have the end product be Flash you would have to purchase the export module for that.
You can Get get here -- http://community.clickteam.com/showthread.php?t=54341&highlight=Extension