Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Shockwave Flash Functions : swf_closefile

swf_closefile

Close the current Shockwave Flash file (PHP 4)
void swf_closefile ( [int return_file] )

Example 2505.  Creating a simple flash file based on user input and outputting it and saving it in a database

<?php

// The $text variable is submitted by the
// user

// Global variables for database
// access (used in the swf_savedata() function)
$DBHOST = "localhost";
$DBUSER = "sterling";
$DBPASS = "secret";

swf_openfile("php://stdout", 256, 256, 30, 1, 1, 1);

   
swf_definefont(10, "Ligon-Bold");
       
swf_fontsize(12);
       
swf_fontslant(10);

   
swf_definetext(11, $text, 1);

   
swf_pushmatrix();
       
swf_translate(-50, 80, 0);
       
swf_placeobject(11, 60);
   
swf_popmatrix();

   
swf_showframe();

   
swf_startdoaction();
       
swf_actionstop();
   
swf_enddoaction();

$data = swf_closefile(1);

$data ?
 
swf_savedata($data) :
 die(
"Error could not save SWF file");

// void swf_savedata(string data)
// Save the generated file a database
// for later retrieval
function swf_savedata($data)
{
   global
$DBHOST,
         
$DBUSER,
         
$DBPASS;

   
$dbh = @mysql_connect($DBHOST, $DBUSER, $DBPASS);

   if (!
$dbh) {
       die (
sprintf("Error [%d]: %s",
                     
mysql_errno(), mysql_error()));
   }

   
$stmt = "INSERT INTO swf_files (file) VALUES ('$data')";

   
$sth = @mysql_query($stmt, $dbh);

   if (!
$sth) {
       die (
sprintf("Error [%d]: %s",
                     
mysql_errno(), mysql_error()));
   }

   @
mysql_free_result($sth);
   @
mysql_close($dbh);
}
?>

Change Language


Follow Navioo On Twitter
swf_actiongeturl
swf_actiongotoframe
swf_actiongotolabel
swf_actionnextframe
swf_actionplay
swf_actionprevframe
swf_actionsettarget
swf_actionstop
swf_actiontogglequality
swf_actionwaitforframe
swf_addbuttonrecord
swf_addcolor
swf_closefile
swf_definebitmap
swf_definefont
swf_defineline
swf_definepoly
swf_definerect
swf_definetext
swf_endbutton
swf_enddoaction
swf_endshape
swf_endsymbol
swf_fontsize
swf_fontslant
swf_fonttracking
swf_getbitmapinfo
swf_getfontinfo
swf_getframe
swf_labelframe
swf_lookat
swf_modifyobject
swf_mulcolor
swf_nextid
swf_oncondition
swf_openfile
swf_ortho2
swf_ortho
swf_perspective
swf_placeobject
swf_polarview
swf_popmatrix
swf_posround
swf_pushmatrix
swf_removeobject
swf_rotate
swf_scale
swf_setfont
swf_setframe
swf_shapearc
swf_shapecurveto3
swf_shapecurveto
swf_shapefillbitmapclip
swf_shapefillbitmaptile
swf_shapefilloff
swf_shapefillsolid
swf_shapelinesolid
swf_shapelineto
swf_shapemoveto
swf_showframe
swf_startbutton
swf_startdoaction
swf_startshape
swf_startsymbol
swf_textwidth
swf_translate
swf_viewport
eXTReMe Tracker