dinamic flash
4 отговора
165 прегледа
dinamic flash
Здравейте дами и господа!
Някой да знае за създаване на на flash от ASP. срещах за PHP(който се интересува, може да пише)(докато няма v.6.0)
Някой да знае за създаване на на flash от ASP. срещах за PHP(който се интересува, може да пише)(докато няма v.6.0)
Re: dinamic flash
тоя компонент ми е известен, но само с ASP имам предвид
това е PHP.
This is a little script for binding the Swift Generator to the PHP scripting language.
What it does:
The class generates a temporary file, which is then called with the generator Binary.
The method makemovie returns the Flash file, which can be piped to the
browser or into a file (for generating greetin cards).
For documentation see swifttest.php
<?php
/*
COPYRIGHT NOTICE #
# Copyright 2000 Martin Scheffler All Rights Reserved. #
# #
# Flashmaker may be used and modified free of charge by anyone so long as #
# this copyright notice and the comments above remain intact. By using this #
# code you agree to indemnify Martin Scheffler from any liability that #
# might arise from it's use. #
# #
# Selling the code for this program without prior written consent is #
# expressly forbidden. In other words, please ask first before you try and #
# make money off of my program. #
Flashmaker 0.01 (c)2000 Martin Scheffler [email protected]
PHP-object for wrapping functions of Swift Generator -
see <[линк]> for documentation
on Swift Generator.
see [линк] for latest version
Please mail comments or requests to: [email protected]
*/
class flashmaker
{
var $swsvars; // will contain the swift sws-file variable definitions
var $substitutes; // will contain the text substitutes definitions
var $tempdir; // well...what do you think?
var $templatefile; // contains location of Flash template file
var $ttfpath;
var $swiftlocation; // contains location of swift generator executable
var $framerate;
var $aditional; //contains extra code for the .sws file
function setoptions($vararray) //generates Variable definition part of .sws file
{
if ($vararray["tempdir"]=="")
$this->tempdir="/tmp";
else
$this->tempdir=$vararray["tempdir"];
$this->templatefile=$vararray["templatefile"];
$this->ttfpath=$vararray["ttfpath"];
$this->framerate=$vararray["framerate"];
$this->swiftlocation=$vararray["swiftlocation"];
}
function setvar($name,$value) //generates Variable definition part of .sws file
{
{$this->swsvars .= "SET $name \"$value\"\n";}
}
/*function setvariables($vararray) //generates Variable definition part of .sws file
{
while (list($key, $val) = each($vararray))
{$this->swsvars .= "SET $key \"$val\"\n";}
}*/
function substitute($id,$subcommands) //generates substitutes part of .sws file
{
$this->substitutes .= "SUBSTITUTE ".$subcommands["TYPE"]." $id {\n ";
while (list($key, $val) = each($subcommands))
{
if (strtoupper($key)=="STRING") $stringset=TRUE;
elseif (strtoupper($key)=="ALIGN") $alignset=TRUE;
elseif ( strtoupper($key)!="TYPE")$this->substitutes .= strtoupper($key)." $val\n";
}
if ($alignset)
$this->substitutes .= "ALIGN \"".strtolower($subcommands["ALIGN"])."\"\n";
if ($stringset)
$this->substitutes .= "STRING \"".$subcommands["STRING"]."\"\n";
$this->substitutes .="}\n";
}
function addline($line)
{
$this->aditional .=$line."\n";
}
function makemovie () // returns .swf file
{
$tempfilename=tempnam($this->tempdir,"swift").".sws";
//-------!!!! generate sws syntax
$swsfile="INPUT \"$this->templatefile\"\n"
."OUTPUT \"-\"\n";
if ($this->ttfpath!="") $swsfile.="TTFPATH \"".$this->ttfpath."\"\n";
if ($this->framerate!="") $swsfile.="FLASH {\nFRAMERATE ".$this->framerate."\n}\n";
$swsfile.=$this->swsvars;
$swsfile.=$this->substitutes;
$swsfile.=$this->aditional;
//-------!!!!
$tempfile=fopen($tempfilename,"w");
fputs ($tempfile,$swsfile);
fclose ($tempfile);
$fsstring=$this->swiftlocation." ".$tempfilename;
//$movie=`$fsstring`; // use "Backtick"-operator to return movie
passthru($fsstring);
unlink ($tempfilename); // delete temp file
// return $movie;
}
}
?>
<?php
include "flashmaker.php";
$test=new flashmaker;
//.........
$options=array // options for movie generation
(
"templatefile" => "/usr/local/httpd/htdocs/swift/test.swt",//watch out for permissions!
"swiftlocation" => "/usr/local/httpd/generator/generator.cgi",//watch out for permissions!
"tempdir" => "", //default is "/tmp"
"ttfpath" => "", //default is none
"framerate" => "" //default is use template value
);
$test->setoptions($options);
//.........
$test->setvar("text1","Beware the mighty");
$test->setvar("text2","Swift Generator!!!");
$test->setvar("demotext","$text");
/* sets generator variables. These variables can be
used in the movie by entering "{variablename}" into
text fields and action scripts. Generator will substitute
these variables on generation.
*/
//.........
// do a text substitution
$subcommands=array(
"TYPE"=>"TEXT", // normally TEXT or TEXTFIELD
"STRING"=>"This is a demo of the PHP script Flashmaker,\na tool for binding Swift Generator to the\nscripting language PHP.", //replace the text
"HEIGHT"=>"16", //replace font height
"FONT"=>"5", //sets id of font, best to be left alone
"COLOR"=>"#FF0000",
"ALPHA"=>"255", // range: 0 - 255
"VSPACING"=>"0.7", // line height
"ALIGN"=>"left" // left, right or center
);
$test->substitute("7",$subcommands);
/*first parameter is the tagId of the object to be modified.
you can get this by running "swift-generator -d templatename.swt,
generator will output an .sws file which can be used for reference.
I'm affraid that is the only way... */
//.........
$test->addline("DEFINE IMAGE \"robotest.gif\" -quality 30 \"robotest.jpg\"");
/*add line of code to the generator file,
this one replaces a picture in the movie.
For more information on swift generator syntax, please go to
[линк]
*/
//.........
// output the movie
header("Content-Type: application/x-shockwave-flash");
echo $test->makemovie();
//use swifttest.php?text=hello for testing
?>
това е PHP.
This is a little script for binding the Swift Generator to the PHP scripting language.
What it does:
The class generates a temporary file, which is then called with the generator Binary.
The method makemovie returns the Flash file, which can be piped to the
browser or into a file (for generating greetin cards).
For documentation see swifttest.php
<?php
/*
COPYRIGHT NOTICE #
# Copyright 2000 Martin Scheffler All Rights Reserved. #
# #
# Flashmaker may be used and modified free of charge by anyone so long as #
# this copyright notice and the comments above remain intact. By using this #
# code you agree to indemnify Martin Scheffler from any liability that #
# might arise from it's use. #
# #
# Selling the code for this program without prior written consent is #
# expressly forbidden. In other words, please ask first before you try and #
# make money off of my program. #
Flashmaker 0.01 (c)2000 Martin Scheffler [email protected]
PHP-object for wrapping functions of Swift Generator -
see <[линк]> for documentation
on Swift Generator.
see [линк] for latest version
Please mail comments or requests to: [email protected]
*/
class flashmaker
{
var $swsvars; // will contain the swift sws-file variable definitions
var $substitutes; // will contain the text substitutes definitions
var $tempdir; // well...what do you think?
var $templatefile; // contains location of Flash template file
var $ttfpath;
var $swiftlocation; // contains location of swift generator executable
var $framerate;
var $aditional; //contains extra code for the .sws file
function setoptions($vararray) //generates Variable definition part of .sws file
{
if ($vararray["tempdir"]=="")
$this->tempdir="/tmp";
else
$this->tempdir=$vararray["tempdir"];
$this->templatefile=$vararray["templatefile"];
$this->ttfpath=$vararray["ttfpath"];
$this->framerate=$vararray["framerate"];
$this->swiftlocation=$vararray["swiftlocation"];
}
function setvar($name,$value) //generates Variable definition part of .sws file
{
{$this->swsvars .= "SET $name \"$value\"\n";}
}
/*function setvariables($vararray) //generates Variable definition part of .sws file
{
while (list($key, $val) = each($vararray))
{$this->swsvars .= "SET $key \"$val\"\n";}
}*/
function substitute($id,$subcommands) //generates substitutes part of .sws file
{
$this->substitutes .= "SUBSTITUTE ".$subcommands["TYPE"]." $id {\n ";
while (list($key, $val) = each($subcommands))
{
if (strtoupper($key)=="STRING") $stringset=TRUE;
elseif (strtoupper($key)=="ALIGN") $alignset=TRUE;
elseif ( strtoupper($key)!="TYPE")$this->substitutes .= strtoupper($key)." $val\n";
}
if ($alignset)
$this->substitutes .= "ALIGN \"".strtolower($subcommands["ALIGN"])."\"\n";
if ($stringset)
$this->substitutes .= "STRING \"".$subcommands["STRING"]."\"\n";
$this->substitutes .="}\n";
}
function addline($line)
{
$this->aditional .=$line."\n";
}
function makemovie () // returns .swf file
{
$tempfilename=tempnam($this->tempdir,"swift").".sws";
//-------!!!! generate sws syntax
$swsfile="INPUT \"$this->templatefile\"\n"
."OUTPUT \"-\"\n";
if ($this->ttfpath!="") $swsfile.="TTFPATH \"".$this->ttfpath."\"\n";
if ($this->framerate!="") $swsfile.="FLASH {\nFRAMERATE ".$this->framerate."\n}\n";
$swsfile.=$this->swsvars;
$swsfile.=$this->substitutes;
$swsfile.=$this->aditional;
//-------!!!!
$tempfile=fopen($tempfilename,"w");
fputs ($tempfile,$swsfile);
fclose ($tempfile);
$fsstring=$this->swiftlocation." ".$tempfilename;
//$movie=`$fsstring`; // use "Backtick"-operator to return movie
passthru($fsstring);
unlink ($tempfilename); // delete temp file
// return $movie;
}
}
?>
<?php
include "flashmaker.php";
$test=new flashmaker;
//.........
$options=array // options for movie generation
(
"templatefile" => "/usr/local/httpd/htdocs/swift/test.swt",//watch out for permissions!
"swiftlocation" => "/usr/local/httpd/generator/generator.cgi",//watch out for permissions!
"tempdir" => "", //default is "/tmp"
"ttfpath" => "", //default is none
"framerate" => "" //default is use template value
);
$test->setoptions($options);
//.........
$test->setvar("text1","Beware the mighty");
$test->setvar("text2","Swift Generator!!!");
$test->setvar("demotext","$text");
/* sets generator variables. These variables can be
used in the movie by entering "{variablename}" into
text fields and action scripts. Generator will substitute
these variables on generation.
*/
//.........
// do a text substitution
$subcommands=array(
"TYPE"=>"TEXT", // normally TEXT or TEXTFIELD
"STRING"=>"This is a demo of the PHP script Flashmaker,\na tool for binding Swift Generator to the\nscripting language PHP.", //replace the text
"HEIGHT"=>"16", //replace font height
"FONT"=>"5", //sets id of font, best to be left alone
"COLOR"=>"#FF0000",
"ALPHA"=>"255", // range: 0 - 255
"VSPACING"=>"0.7", // line height
"ALIGN"=>"left" // left, right or center
);
$test->substitute("7",$subcommands);
/*first parameter is the tagId of the object to be modified.
you can get this by running "swift-generator -d templatename.swt,
generator will output an .sws file which can be used for reference.
I'm affraid that is the only way... */
//.........
$test->addline("DEFINE IMAGE \"robotest.gif\" -quality 30 \"robotest.jpg\"");
/*add line of code to the generator file,
this one replaces a picture in the movie.
For more information on swift generator syntax, please go to
[линк]
*/
//.........
// output the movie
header("Content-Type: application/x-shockwave-flash");
echo $test->makemovie();
//use swifttest.php?text=hello for testing
?>
Re: dinamic flash
Ne moga da razbera zashto prashtash tozi script? A syshto i vyprosa ti...bydi po-konkreten! Ako ti trqbva syzdavane na dynam. flash ot ASP linka koito sym postnal shte ti svyrshi rabota...Vidqh che si postnal tazi tema i v PHP cluba...ta ne mojesh da preobrazyvash koda ot PHP v ASP. Tova sa dva otdelni, razlichni ezika.
|Не се изказвай за неща, които не разбираш|
|Не се изказвай за неща, които не разбираш|
Re: dinamic flash
parvo tozi komponent struva ok 500USD.
Chtom e component, ha nechto e napisan.
znatchi moje da se napiche takuv.
Srechtal sa za preabraruvane na ASP v PHP (s programa) avtomatichno ASP2PHP, moje da poglednech v yahoo
Chtom e component, ha nechto e napisan.
znatchi moje da se napiche takuv.
Srechtal sa za preabraruvane na ASP v PHP (s programa) avtomatichno ASP2PHP, moje da poglednech v yahoo