Flash - Hangman

Contents


Quick Start

  1. Upload hangman-auto.swf to a directory on your web server.
  2. Edit hangman-default.xml to your taste then upload it to the same directory as hangman-auto.swf. Hopefully the layout of this file is self-explanatory.
  3. Create a web page that contains hangman-auto.swf. Perhaps the easiest way is to use the boxes.js file.
    • include this line in the <HEAD> of your web page:
      <script type="text/javascript" src="boxes.js"></script>
    • Include this line in your web page where you want the movie to appear:
      <script type="text/javascript>putFlash6(550, 400, 'hangman-auto.swf', null);</script>
    • Upload boxes.js to the same direcory.

Download these files

Example 1

The HTML for this is:

<script type="text/javascript>putFlash6(550, 400, 'hangman-auto.swf', null);</script>

Click for more detail on the javascript function

In general:

<script type="text/javascript">
putFlash6(width, height, filename, id, colour);
</script>

The first two parameters width and height are mandatory. The original size of the movie is 550×400 so you should try to keep width and height in an 11:8 ratio.

The third parameter filename is also mandatory. You can leave it as 'hangman-auto.swf' in which case the file hangman-default.xml will be used as the wordsearch. If you want to use a different wordsearch then append a query string to the filename. In which case you might use something like...

<script type="text/javascript>
putFlash6(550, 400, 'hangman-auto.swf?xmlFile=my-wordlist.xml', null);
</script>

The fourth parameter id is the id of the movie in the DOM. If you don't care about this then just use something like 'movie1' or leave it out completely.

The fifth parameter colour is the background colour of the movie in the usual HTML format. You can miss this out in which case #DDDDDD will be used.

Word lists

The words lists are stored in an XML file.

If you want to use your own word list then have a look at the hangman-default.xml file. The structure should be self-evident.

To use your own word list then you will need to do something like this:

<script type="text/javascript>
putFlash6(550, 400, 'hangman-auto.swf?xmlFile=my-wordlist.xml', null);
</script>

Look at the hangman-default.xml file

This is just a plain text file with a particular structure. The hangman-default.xml file looks like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<wordset>
   <title>Pot Luck</title>
   <!-- the title is mandatory -->
   <!-- each item must contain both word and hint elements, but the hint doesn't have to be helpful. -->
   <item>
      <word>bucket</word>
      <hint>Don't kick it.</hint>
   </item>
   <item>
      <word>sandwich</word>
      <hint>Two slices.</hint>
   </item>
   <item>
      <word>dictionary</word>
      <hint>A book.</hint>
   </item>
   <item>
      <word>pencil</word>
      <hint>Take the lead.</hint>
   </item>
   <item>
      <word>stick insect</word>
      <hint>Animal or vegetable?</hint>
   </item>
   <item>
      <word>haddock</word>
      <hint>Something fishy.</hint>
   </item>
   <item>
      <word>Labrador</word>
      <hint>Canadian dog.</hint>
   </item>
   <item>
      <word>television</word>
      <hint>Goggle box.</hint>
   </item>
   <item>
      <word>Coca Cola</word>
      <hint>The real thing.</hint>
   </item>
   <item>
      <word>pajamas</word>
      <hint>Time for bed.</hint>
   </item>
   <item>
      <word>David Beckham</word>
      <hint>A Real footballer.</hint>
   </item>
   <item>
      <word>fortunate</word>
      <hint>You might get lucky.</hint>
   </item>
   <item>
      <word>fireworks</word>
      <hint>Goes off with a bang.</hint>
   </item>
   <item>
      <word>cardboard box</word>
      <hint>You wouldn't want to live in one.</hint>
   </item>
   <item>
      <word>alarm clock</word>
      <hint>Helps you to get up.</hint>
   </item>
   <item>
      <word>Atmosphere</word>
      <hint>The Earth has one.</hint>
   </item>
   <item>
      <word>Jurassic</word>
      <hint>A park as old as the hills.</hint>
   </item>
   <item>
      <word>Tony Blair</word>
      <hint>Resident of Number 10.</hint>
   </item>
   <item>
      <word>asparagus</word>
      <hint>Sparrow grass.</hint>
   </item>
   <item>
      <word>Manchester</word>
      <hint>A united city</hint>
   </item>
   <item>
      <word>horse chestnut</word>
      <hint>Easily conkered.</hint>
   </item>
   <item>
      <word>Autumn</word>
      <hint>Falls once every year.</hint>
   </item>
   <item>
      <word>spatula</word>
      <hint>Scraping the barrel.</hint>
   </item>
   <item>
      <word>Kangaroo</word>
      <hint>A jumper, but not wooly.</hint>
   </item>
   <item>
      <word>shepherd</word>
      <hint>His pie's a delight.</hint>
   </item>
   <item>
      <word>sequoia</word>
      <hint>Big wood.</hint>
   </item>
   <item>
      <word>Afghanistan</word>
      <hint>Where the dogs (and rugs) come from.</hint>
   </item>
   <item>
      <word>experiment</word>
      <hint>Give it a try.</hint>
   </item>
   <item>
      <word>fjord</word>
      <hint>Nordic valley.</hint>
   </item>
   <item>
      <word>sesquipedalian</word>
      <hint>About 18 inches?</hint>
   </item>
</wordset>

It should be pretty obvious how this works. Note that there is no validation -- any typos in your file will probably cause the wordsearch to fail.

Example 2

The HTML for this is:

<script type="text/javascript>
putFlash6(550, 400, 'hangman-auto.swf?xmlFile=insect-words.xml', null, '#cc9988');
</script>

Example 3

The HTML for this is:

<script type="text/javascript>putFlash6(550, 400, 'hangman-loadable.swf', null);</script>

hangman-loadable.swf is another variation. The choices are hard-coded in the flash source file.

Changing the appearance.

If you want to change the appearance other than the background colour then you will need the flash source files (and a flash authoring toolcapable of dealing with Flash 6 files). You can get the flash source files here.

Bugs and Updates

You can find the latest version at subtangent.com. If you find this useful, have any improvements or put it on a web site I'd be grateful if you could let me know

Duncan Keith 2004-03-19
Documentation updated: 2005-03-19