示例#1
0
<?php

header("Content-Type: application/x-shockwave-flash");
//-----------------------------------------------------//
// the header() function must _always_ be called first //
//-----------------------------------------------------//
//-------------------------------------------------------
// import the FreeMovieCompilerTollbox
require_once "freemoviecompilertoolbox.php";
//-------------------------------------------------------
// initialize new SWF object.
$swf = new FreeMovieCompilerToolbox();
//-------------------------------------------------------
// set the global parameters of your movie
// frame size is in twips (1 twip = 20 pixels)
$swf->SetSWFVersion(5);
$swf->SetFrameSize(16000, 12000);
// = 800 x 20, 600 x 20
$swf->SetFrameRate(24.0);
$swf->SetBackgroundColor(255, 255, 255);
//-------------------------------------------------------
// lights! camera! action!
$swf->BeginMovie();
//-------------------------------------------------------
// frame # 00000
$CharacterInfo = $swf->DefineCurvedLine(2000, 2000, 3000, 6000, 4000, 2000, 300, false, 0, 0, 0, 0);
$CharacterDepth = $swf->EasyPlaceObject($CharacterInfo["CharacterID"]);
//-------------------------------------------------------
// end frame # 00000
$swf->EndFrame();
//-------------------------------------------------------
示例#2
0
<?php

header("Access-Control: allow <*>");
//Support Cross Domain
$xmlstr = stripslashes($_REQUEST['svg']);
$xml = new SimpleXMLElement($xmlstr);
//Flash:
require_once "freemoviecompilertoolbox.php";
$height = $_REQUEST['height'];
$width = $_REQUEST['width'];
$framerate = $_REQUEST['framerate'];
$swf = new FreeMovieCompilerToolbox();
$swf->SetSWFVersion(5);
$swf->SetFrameSize($width * 20, $height * 20);
$swf->SetFrameRate($framerate);
$swf->SetBackgroundColor(255, 255, 255);
$swf->BeginMovie();
function rgbConvert($rgb_str)
{
    $rgb = $rgb_str;
    $rgb = str_replace("rgb(", "", $rgb);
    $rgb = str_replace(")", "", $rgb);
    $rgbArray = explode(",", $rgb);
    return $rgbArray;
}
$totalSWFObjects = 0;
foreach ($xml->svg as $svg) {
    if ($svg['t'] != 'f') {
        if ($charid != null || $chardepth != null) {
            for ($p = 0; $p <= $totalSWFObjects - 1; $p++) {
                $swf->RemoveObjectFromLayer($charid[$p], $chardepth[$p]);
示例#3
0
文件: swf.php 项目: rzel/ajaxanimator
<?php

if ($_REQUEST["action"] == "test") {
    die("working");
    //hmm... I don't want to die working... Especially for this project....
}
//header("Content-Type: application/x-shockwave-flash");
include "../lib/jsoncheck.php";
include "../lib/freemoviecompilertoolbox.php";
//include "test.php";
$swf = new FreeMovieCompilerToolbox();
$cwidth = 480;
$cheight = 272;
$swf->SetSWFVersion(5);
$swf->SetFrameSize($cwidth * 20, $cheight * 20);
// = 800 x 20, 600 x 20
$swf->SetFrameRate(12.0);
$swf->SetBackgroundColor(255, 255, 255);
$animation_array = json_decode(stripslashes($_REQUEST["animation"]), true);
$previous_id_array = array();
$previous_depth_array = array();
foreach ($animation_array as $frame_contents) {
    for ($p = 0; $p < count($previous_depth_array); $p++) {
        $swf->RemoveObjectFromLayer($previous_id_array[$p], $previous_depth_array[$p]);
    }
    $previous_id_array = array();
    $previous_depth_array = array();
    foreach ($frame_contents as $shape) {
        switch ($shape["type"]) {
            case "rect":
            case "roundrect":