From a simple PHP file, you can make for owner a flash game. Still same as an extension GD, MySQL, ..., PHP support for flash by extension MING (php_ming.dll). Some host php support MING for free is: http://www.host.sk
In this port, I will guide how to make a small small flash file:
Ã, Ã, First of all, to using the class SWF, you must be enable
php_ming.dll in the
php.ini file (find line
;extension=php_ming.dll and delete code ; ).
Ã, Ã, You need creat a php file (ex: flash.php) and insert to this code:
Quote<?php
//*****************************\\
ob_start();
if(extension_loaded('ming')){
Ã, Ã, //*
Ã, Ã, $myMovie = new SWFMovie();// creat a object class for SWFMovie
Ã, Ã, $myMovie->setDimension(400,300);//Height and width of your flash
Ã, Ã, $myMovie->setRate(24);// chạy
Ã, Ã, $myMovie->setBackground(200,0,200);// Màu ná»Ân
Ã, Ã,Â
Ã, Ã, // Draw a new shape for the flash
Ã, Ã, $shape = new SWFShape();// a sharpe in your flash movie
Ã, Ã, $shape->setLine(5,255,255,3);// data for line (color, width)
Ã, Ã, $shape->movePenTo(0,0);// move the brush
Ã, Ã, $shape->drawLine(10,20);// draw a line
Ã, Ã,Â
Ã, Ã, // Add the shape to the Flash
Ã, Ã, $shapeHandle = $myMovie->add($shape);// Ã,,‘ưa hình shape cá»§a bạn vào movie flash
Ã, Ã, // Add animation to the Flash
Ã, Ã, $shapeHandle->moveTo(150,150); // move to ordinate...
Ã, Ã, //Make frames for movie flash (rotate shapes 10 degree)
Ã, Ã, for($i=1;$i<36;$i++){
Ã, Ã, Ã, Ã, $shapeHandle->rotate(10);
Ã, Ã, Ã, Ã, $myMovie->nextFrame();
Ã, Ã, };
Ã, Ã,Â
Ã, Ã, // Output the Movie
Ã, Ã, // To header of php file is flash
Ã, Ã, header("content-type:application/x-shockwave-flash");
Ã, Ã,Â
Ã, Ã, // Finally, insert the flash movie to the screen
Ã, Ã, $myMovie->output();
Ã, Ã, //*/
} else {
Ã, Ã, echo 'Ming Extension is not loaded!
In order to use this site, please load this extension.';
};
ob_end_flush();
//*****************************\\
?>
However, you can drawing any sharpe for this movie, add action script for flash. This's a part of the of the Games progammimg in php document.Ã, ;)
P/S:
You can run this flash I've been presented by index.php file follow:
Quote<object class="" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="300" id="swfTest">
Ã, Ã, <param name="movie" value="flash.php">
Ã, Ã, <embed src="flash.php" type="application/x-shockwave-flash"
Ã, Ã, Ã, Ã, pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
Example you can see at: http://huykhoi.host.sk/ming/
Here really is a HTML pageÃ, :laugh: