Home
HomeFlexible, Lightweight and Truly Skinnable Flash ComponentsPHPObject and other Flash ExtensionsForumsBlog JournalLinks
Buy Flash Components
  PHPObject - Opensource PHP Flash Remoting

redhand Using PHPObject to Save and Retrieve Simple Game Levels "Getting Started"

Author
Tor de Vries


What You Need
The Flash file is "leditor.fla", and the PHP class file is "Leditor.php", both available in this downloadable archive (Leditor.zip, 168k). The Flash file requires Flash MX 2004, and uses some components from Flash MX 2004 Pro.

To install PHPObject, you need to install the free Macromedia Extensions Manager.

You also need Ghostwire's free PHPObject Flash remoting libraries. As of this writing, the latest version is v1.45. Newer versions may or may not work the same. Once you have downloaded and expanded the PHPObject ZIP archive, double-click on the file "PHPObject.mxp". This will launch the Extensions Manager and walk you through the process of installing the relevant Flash libraries

You also need a web browser with a recent copy of the Flash plug-in. Mac users, note that versions of Apple's Safari browser prior to 1.2 do not work correctly with Flash remoting, although Internet Explorer 5 and Netscape 7 work fine.

To test out the sample level editor, you also need a web server that has PHP4. The examples in this document use a Mac OS X system, with the computer itself as the web server ("localhost"). However, any web-accessible server should work. You will need to be able to put files in a directory (via ftp) and access them from a web browser (via http://). Create a directory on your web server (such as "leditor"). (Depending on how your server is configured, you may need to change the file permissions of your directory to allow everyone to write to it. Most FTP and SFTP programs offer simple ways of setting these permissions.)

Finally, open up the "leditor.fla" file in Flash MX 2004. Click on the first frame of the first layer and look at the ActionScript in that frame. Near the top, you will see this line:

_global.defaultGatewayDir = "http://localhost/leditor/";

                                    

The second half of this line is the web URL to the directory you created on the server. If this is not running on your local computer ("localhost"), then change it to the actual URL of the directory you just created (such as "http://a.parsons.edu/~paul/leditor/"). Then, go into Flash's "Publish Settings" and make sure it is set to create Flash Player 6 movies (not Flash Player 7!) and publish the movie to the file "leditor.swf".


Setting Up the Game Editor
To run the level editor, copy the following files into the directory you created on your web server:

- leditor.swf which you just published from Flash, above.

- index.html from the leditor download.

- Sample_Level.xml from the leditor download.

- Leditor.php from the leditor download.

- Gateway.php from the PHPObject download (in its "server" folder).

- config.php from the PHPObject download (in its "server" folder).

To test it, pull up your leditor directory in your web browser. You should see something like this:

If you've gotten this far, great! You can open the sample level, or use the level objects to draw your own level and save it to the server.

Next:
The Concepts of PHPObject




About PHPObject

PHPObject is an opensource alternative to Flash Remoting for PHP developers. With PHPObject, you can call a method of a PHP class/library on your web server as if the class/library was defined in Flash itself. It takes care of your client-server connections and makes passing of variables (properties) between Flash MX and PHP easy, and thereby providing a convenient way to connect rich media clients with data and business logic residing on your server.

PHPObject is developed by GhostWire Studios and released under the GNU LGPL.


>> Documentation <<

 
Contact UsSite Map
Copyright © 2003-2006 GhostWire Studios