TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 18, 2024, 04:55:05 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 203
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 193
  • Total: 193

Using PHP to creat a flash movie

Started by elpvn, February 19, 2006, 01:29:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

elpvn

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: