Wednesday, January 19, 2011

how to play flash games offline from ubuntu application menu

Download the flash game you want

The first step is to get the game onto your computer. To do this, go to the webpage where the game is found, for example:

Then on the page right click, and view the source. Then find the url for the actual game source. The easiest way to find the url is to search for it (common keyboard shortcut Ctrl + F). Try searching for the name of the game, or for .swf.

When you think you’ve got it, (from the page above the url you should have found is: ) click on it, and it should open up in a new tab. If it was the correct URL, save the page. When you do this, check that it is just downloading the .swf file. I suggest adding a . before the name to make it a hidden file and saving it to your home folder.

Adding the entry to the Main Menu

Now, to create an entry for it in the games menu, right click on the gnome menu and go to ‘Edit Menus.’

Then go to internet, find your Chrome or Chromium entry and view its properties. Copy the command field. Now go to games, and click New Item to add to create a new entry.

Paste the command you copied before and add –app=file:// followed immediately by the path to the .swf file.

For example here is mine:

/usr/bin/chromium-browser --app=file:///home/chris/.curveball.swf

The –app opens the file as if it is an application, rather than a webpage, so your game will look native, rather than look as if it were running in a browser. Once your done with the command field, you can fill out the rest: name, description, and even give it an icon. Click ok and give it a try.

If you’re a Firefox person, you can’t run it as an app, but if you enter ‘firefox’ followed by file:// and the path to the game, it should open the game in a full browser.

The result

Launch your app from the Main Menu and you should see something like this:

Many thanks to Chris for the sweet instructions.