I am doing a school project and the guy I am doing it with want some animations. Since gif animations are not supported by php (patent trouble) I had to make a flash movie. I allready have the basic code and stuff but the images I try to import in my flash movie don't show. I am trying to use a gameboard as background for the movie. After the TODO comment I am going to edit the image so I get an animation, but first things first so this is my code:

CODE

<?php
//invoer:
//array met posities van de huizen $huis
//array met posities van de hotels $hotel
//array met posities van de spelers $speler
//begin en eindpositie van de bewegende pionen $begin en $eind
//mp3 om te spelen $mp3

//nieuwe sprite (bewegend plaatje)
$sprite = new swfSprite();

//loop door de frames
for($x = $begin; $x <= $eind; $x++)
{
//laad plaatje
$image = imageCreateFromJpeg('images/monopoly.jpg');

//TODO: tekenen huizen, pionnen, animatie etc.

//voer image stream uit en buffer het
ob_Start();
imageJpeg($image);
$buffer = ob_Get_Contents();
ob_End_Clean();

//voeg image toe aan shape
$frame = new swfShape();
$bmp = new swfBitmap($buffer);
$frame->addFill($bmp);

//voeg het frame toe aan het filmpje en ga naar het volgende frame
$sprite->add($frame);
$sprite->nextFrame();
}

//voeg de sprite toe aan een filmpje
$movie = new swfMovie();
$movie->add($sprite);

//bewerkt filmpje voor uitvoer
$movie->setBackground(255, 255, 255);
$movie->setDimension($bmp->getWidth(), $bmp->getHeigth());
if(isset($mp3))
{
$movie->streamMp3(file_get_contents($mp3));
}

//voer flash uit
header('Content-type: application/x-shockwave-flash');
$movie->output();
?>


Sorry for the comments, don't have time to translate them. Can anyone tell me how to get this working? I get a flash movie outputted but it's blank. Thanx in advance.

 

 

 


Reply