Welcome
This is where you can play fun Flash games with intuitive controls, no long tutorials, and varied gameplay. You will also find useful resources, tutorials, and thoughts on game design and development.
Thanks for visiting and enjoy your stay!
This is where you can play fun Flash games with intuitive controls, no long tutorials, and varied gameplay. You will also find useful resources, tutorials, and thoughts on game design and development.
Thanks for visiting and enjoy your stay!
According to the AS3 documentation you can loop a sound by passing in a loop number argument when you call play on a sound. Apparently, that never seems to work consistently for me. Sometimes it would not loop after a number of times, or it doesn’t loop immediately. So I usually just manually control the looping of music with Event Listeners.
To do this, I add an Event Listener to the music channel that will call a function to replay the sound whenever it’s done playing once.
public function playMusic():void
{
musicChannel = music.play();
musicChannel.addEventListener(Event.SOUND_COMPLETE, loopMusic);
}
public function loopMusic(e:Event):void
{
if (musicChannel != null)
{
musicChannel.removeEventListener(Event.SOUND_COMPLETE, loopBackgroundMusic);
playMusic();
}
}
So the sound will continue to loop forever until I stop it. Whenever I do, I have to remove the Event Listener from the music channel or else it won’t be garbage collected.
public static function stopMusic():void
{
if (musicChannel != null)
{
musicChannel.stop();
musicChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
}
}
That’s about it. A pretty simple solution to an annoying problem sometimes.

If you’ve made a Flash game with a PHP high score table without any security before, you’ve probably found some unpossible scores sitting on top of your chart when you wake up one morning. Well, in this tutorial, we’ll see how to implement a simple encryption system that is relatively secure for Actionscript 3.0. It’s not perfectly secure, but it will fend off your usual score cheater. This tutorial also assumes that you know the basics of implementing a high score system in Flash and PHP. If you don’t, please check out this tutorial.
The basic concept of this method is to use MD5 to hash the submission data with a key. Then we send the data, along with the MD5 hash to the PHP script. The PHP script takes the data, and hashes it with the same key. If the two hashes match, then we know it’s legit.
First, let’s go over what to do on the Flash side of things. We will need an encryption API capable of MD5 for AS3, such as this encryption package by Geoffrey Williams. There are others which can be found by Googling, but this one is pretty simple to use.
Suppose we want to submit the player’s name and score, we construct a string of those values:
var playerData:String = playerName + playerScore;
Then we use the MD5 package to hash it with a key, which is a secret string that we make up. Assuming we are using the package shown above, the code would look something like this:
var key:String = "HASH_KEY";
var hashData:String = MD5.hex_hmac_md5(key, playerData);
After we have this, we just send both the playerData and hashData to our PHP score submission script using a POST method.
Over on the PHP script, we take the playerData, and run it through MD5 with the same secret key that we used in Flash. If the result matches the hashData that we received from Flash, then it’s a valid score submission. The operative PHP functions here are bin2hex and mhash.
$key = "HASH_KEY";
$result = bin2hex(mhash(MHASH_MD5, $playerData, $key));
if ($result == $hashData)
{
//record submission
}
Thats all there is to this encryption method. You’ve probably noticed, but the one flaw to this method is that if the hacker has access to the Flash source, then he can find out the secret key and beat the system. Fortunately, as far as I know, there are no public AS3 decompilers yet. Should one appear, we’d have to use obfuscation to hide the key or use some sort of SWF encryption program such as Amayeta. Nonetheless this method should keep most casual cheaters off your back.

One of the more common questions in flash game development is where to get free sounds or music.
Probably the best free sound archive I know of is Soundsnap. They have tons of sounds effects, sound loops, and music samples. And they’re all free to use in your games!
You can find almost any sound there, and if you can’t find exactly what you’re looking for, you can use Audacity to the modify the sounds until you get what you want. The program is open source and ultra easy to use. I get particularly good results from mixing together a couple of similar sounds to get a richer sound effect. But be careful not to mix too many or else it’ll sound disorganized.
As for a free music site, I don’t know of an all-encompassing site like Soundsnap but I do like opsound. They have a good selection of nice music there. The songs are covered under the Creative Commons License so it’s best to to ask for permission before using it in a commercial game. Most artists will be happy to be featured in a wide release game so it shouldn’t be a problem to ask.
Aside from submitting the game link to blog sites, I’ve also been submitting the SWF itself to flash game sites, such as Newgrounds and Kongregate. Actually, the sponsor submitted it to Newgrounds. I think they’re also going to submit it to other sites, so I don’t have to do a lot of the SWF propagation work.
So far, OrbBlaster’s garnered pretty positive reviews, managing to make front page on Newgrounds. It’s doing okay on Kongregate, which I think is because it doesn’t have any badges or achievements tie-ins for the site. Kongregate players love the achievements so I might have to implement some sort of it.
Spreading the SWF is a great way to reach other players, but I probably should have put a more visible link to doogog.com. Currently, it’s inside of the Credits button, which seems like not many people check out.
I also submitted my site to the Yahoo and Google directories, and am going to try linkdumps, too.