PHP Game Development in Flash and PHP
PHP Game Development in Flash and PHP
Preloaders
Security
PHP
Database
Security
Q&A
Embedding Flash
<embed
src="file.swf"
width="300"
height="300"
flashvars="myvar=99&myvar2=200"
/>
function loadClient() {
var loader:Loader = new Loader();
configureListeners(loader.contentLoaderInfo);
var request:URLRequest = new URLRequest(url);
loader.load(request);
addChild(loader);
}
function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
}
function completeHandler(event:Event):void {
removeChild(loaderClip); // Remove preloader progress clip
}
IOErrorEvent.IO_ERROR // File not found etc...
HTTPStatusEvent.HTTP_STATUS // 404 error etc...
ProgressEvent.PROGRESS // Update progress bar
Misc other events: Event.UNLOAD, OPEN, INIT etc...
Communicating with PHP
var req:URLRequest =
new URLRequest(“submit.php”);
function loadInfoCompleteHandler(event:Event):void {
var xml:XML = new XML(event.target.data);
var tobj = xml.elements('myoutputlist');
mydata = xml.elements('myoutputlist')[0].attribute("var1");
}
Security
Client-side
Not secured
Decompiler
Solution
Obfuscation
Manipulating variables
Server-side processing
Storing Player Data
Data to store:
Highscore List
Game variables
Table Types
Static
MyISAM vs InnoDB
Memory
Clean Inputs:
Use intval() for all integer values
To show:
Demo from battlestations.
Contact: [email protected]
Try the game:
http://apps.facebook.com/battlestations