Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes

Php Programming Code Examples

Php > Graphics Code Examples

List to SWF

List to SWF <?PHP */ $list: uni dimensional array. REMOVE special charactes (non-english characters), otherwise the script will crash and burn. $file: string. Name you want the file to be saved to, include the .swf extension. $x: integer. Desired width of your movie. $y: integer. Desired height of your movie. $f_size: Desired font size for the list. Of course, you could include the r, g and b, font and other characteristics in the function, feel free to experiment by yourself. /* function list_to_swf($list, $file, $x, $y, $f_size) { */ swf_openfile (filename, width, height, framerate, r, g, b) r g & b are colors in percentages for the background /* swf_openfile ($file, $x, $y, 25, 0.73, 0.81, 0.56); $objectid=0; // fonts must be in a "font" directory at the same level this script is running swf_definefont (1, "Pix3"); swf_fontsize ($f_size); swf_fontslant (0); // Initial position to place the first item $y=$y-($f_size-3); $objectid=2; // this function allegedly places better looking text. swf_posround(1); // repeat for each item on the list for ($x=0; $x<count($list); $x++) { $texto= $list[$x]; // define text with id = $objectid. swf_definetext ($objectid, $texto, 0); // I don't know what these two next lines do and why should they be there // but they work :) swf_pushmatrix (); swf_translate (8, $y, 0); // place the text on the movie in black swf_addcolor(0,0,0,0); swf_placeobject ($objectid, 1); // again, not sure what this next command does... swf_popmatrix (); // advance postion for the next item $y=$y-($f_size+1); // increase object id count. $objectid++; } // displays the current frame swf_showframe (); // close your file and save to disk swf_closefile (); } // now, call the SWF file with html ?> <html> <body> <!-- WATCH OUT! Remember to replace the name of your file and size of you movie! --> <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" ID=menu WIDTH="X" HEIGHT="Y"> <PARAM NAME=movie VALUE="NAME_OR_YOUR_FILE"> <PARAM NAME=quality VALUE=high> <EMBED src="NAME_OR_YOUR_FILE" quality=high WIDTH="X" HEIGHT="Y" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </EMBED></OBJECT> </body> </html>