Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: Shockwave Flash 関数 - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

swf_actiongeturl" width="11" height="7"/> <wordwrap
Last updated: Mon, 05 Feb 2007

view this page in

CLX. Shockwave Flash 関数

導入

PHP は、Paul Haeberli が作成した libswf モジュールにより Shockwave Flash ファイルを作成する機能を提供します。

注意: SWF サポートは、PHP 4 RC2 で追加されました。

libswf は、Windows でサポートされていません。このライブラリの 開発は中止されており、他のシステムへ移植するためのソースは 入手できません。

最新の SWF サポートについては、 MING 関数を参照してください。

注意: この拡張モジュールは » PECL レポジトリに移動 されており、以下のバージョン以降 PHP にバンドルされなくなっています。 PHP 5.0.0.

要件

PHP でこの拡張モジュールを使用するようコンパイルするためには、 libswf ライブラリを必要とします。 libswf は » ftp://ftp.sgi.com/sgi/graphics/grafica/flash/ でダウンロードする ことができます。

インストール手順

libswf を入手した後にするべきことは、configure に --with-swf[=DIR] を指定すること だけです。ただし、DIR はディレクトリ include および lib を有する場所です。 ディレクトリ include にはファイル swf.h が、ディレクトリ lib には ファイル libswf.a がある必要があります。libswf の配布ファイルを展開した際には、 二つのファイルは一つのディレクトリにあります。結果的に、ファイルを 適当な場所に手動でコピーする必要があります。

実行時設定

設定ディレクティブは定義されていません。

リソース型

リソース型は定義されていません。

定義済み定数

以下の定数が定義されています。 この関数の拡張モジュールが PHP 組み込みでコンパイルされているか、 実行時に動的にロードされている場合のみ使用可能です。

MOD_COLOR (integer)
MOD_MATRIX (integer)
TYPE_PUSHBUTTON (integer)
TYPE_MENUBUTTON (integer)
BSHitTest (float)
BSDown (float)
BSOver (float)
BSUp (float)
OverDowntoIdle (integer)
IdletoOverDown (integer)
OutDowntoIdle (integer)
OutDowntoOverDown (integer)
OverDowntoOutDown (integer)
OverUptoOverDown (integer)
OverUptoIdle (integer)
IdletoOverUp (integer)
ButtonEnter (integer)
ButtonExit (integer)
MenuEnter (integer)
MenuExit (integer)

PHP を Shockwave Flash サポート付きでインストールした後は、 Shockwave ファイルを PHP から作成することができるようになります。 何ができるかが分かると驚かされることでしょう。次のコードを見てください。

例 2340. SWF の例

<?php
swf_openfile
("test.swf", 256, 256, 30, 1, 1, 1);
swf_ortho2(-100, 100, -100, 100);
swf_defineline(1, -70, 0, 70, 0, .2);
swf_definerect(4, 60, -10, 70, 0, 0);
swf_definerect(5, -60, 0, -70, 10, 0);
swf_addcolor(0, 0, 0, 0);

swf_definefont(10, "Mod");
swf_fontsize(5);
swf_fontslant(10);
swf_definetext(11, "This be Flash wit PHP!", 1);

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

for (
$i = 0; $i < 30; $i++) {
  
$p = $i/(30-1);
  
swf_pushmatrix();
  
swf_scale(1-($p*.9), 1, 1);
  
swf_rotate(60*$p, 'z');
  
swf_translate(20+20*$p, $p/1.5, 0);
  
swf_rotate(270*$p'z');
  
swf_addcolor($p, 0, $p/1.2, -$p);
  
swf_placeobject(1, 50);
  
swf_placeobject(4, 50);
  
swf_placeobject(5, 50);
  
swf_popmatrix();
  
swf_showframe();
}

for (
$i = 0; $i < 30; $i++) {
  
swf_removeobject(50);
   if ((
$i%4) == 0) {
      
swf_showframe();
   }
}

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

swf_closefile();
?>

目次

swf_actiongeturl — Shockwave Flash ムービーから URL を得る
swf_actiongotoframe — フレームを実行した後、停止する
swf_actiongotolabel — 指定したラベルを有するフレームを表示する
swf_actionnextframe — フレームを一つ進める
swf_actionplay — 現在のフレームから flash ムービーの実行を開始する
swf_actionprevframe — フレームを一つ戻す
swf_actionsettarget — アクションのコンテキストを設定する
swf_actionstop — 現在のフレームで flash ムービーの実行を終了する
swf_actiontogglequality — 低品質/高品質を切り替える
swf_actionwaitforframe — フレームがロードされていない場合にアクションをスキップする
swf_addbuttonrecord — 現在のボタンの位置、外観、アクティブエリアを制御する
swf_addcolor — グローバル加算色を、指定した rbga 値に設定する
swf_closefile — 現在の Shockwave Flash ファイルを閉じる
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 — グローバル乗算色を指定した rbga 値に設定する
swf_nextid — 次の未使用のオブジェクト ID を返す
swf_oncondition — アクションリストのトリガとして使用されるトランジションを定義する
swf_openfile — 新規に Shockwave Flash ファイルをオープンする
swf_ortho2 — ユーザ座標の 2D 直交マッピングを現在のビューポイントに定義する
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 — 描画を行う範囲を選択する


add a note add a note User Contributed Notes
Shockwave Flash 関数
vivid at bwteam dot org
15-Nov-2004 10:52
I am using ActiveSWF toolkit to produce dynamic Flash movies from XML. I like it, because only I need to produce new dynamic movie is new XML. PHP code is the same. Additionally, it has quite good documentation. See http://www.activeswf.com
Mark Dijkman The Netherlands
14-Jan-2004 08:16
Let's not forget to mention there IS another alternative to Swf-lib and Ming. It's called FreeMovie and is created by Jacek Artymiak from O'Reilly. This piece of art is made out of PHP-files only wich makes it suitable for many platforms. The project is also available via SourceForge as freemovie-php.

Thumbs up for that one!
manuel DOT leiner AT gmx DOT de
29-Jul-2002 08:20
Just to mention for users of SuSE 8.0. libswf is included with the distro with no fonts. Therefore you must "patch" libswf support. As I didn't find the solution here before and I found a solution I am posting this fix:
Download the libswf package and uncompress to a directory (e.g. /usr/share/php/swf). Then include
"
SWFFONTPATH=/path/to/fonts
export SWFFONTPATH
"
Then log out and in again and restart apache. Then you should be able to use flash text functions within PHP.
daemorhedron
07-Mar-2002 03:50
For those having problems with libswf fonts you can add a system wide variable to point to the fonts dir in your shell.

In linux open up /etc/profile and add the lines :

SWFFONTPATH=/path/to/fonts
export SWFFONTPATH

Please not all of that is case sensitive, so copy it carefully. Logout and log back in to see changes (should affect all users). Test it from the command line with echo $SWFFONTPATH

For windows users you should be able to add

SET SWFFONTPATH=/path/to/fonts

in your autoexec.bat or autoexec.nt. Test it with echo %SWFFONTPATH%

HTH! =)
seek at byte-net dot ro
26-Jan-2001 10:06
Hot to make it right.
I have a /kit/php4 folder
I made a flash folder into that folder. Looks like
/kit/php4/flash
Here made 2 folders called lib and include
/kit/php4/flash/include
/kit/php4/flash/lib
Copy libswf.a in lib folder and swf.h in include folder
go to /kit/php4 folder and ./configure --with-swf=flash [--add your other configure params]
make
make install
works great
Note. In fact I have all unziped swf kit in /kit/php4/flash folder and I added the new 2 folder [lib and include]. Then copy specified files into them.
isu at tozsdeforum dot hu
17-Jan-2001 01:11
This works also! Write into the script:
putenv ("SWFFONTPATH=/path_to_swf/fonts");
Maybe you can do the job with apache somehow, but it did't work for me. (With getenv it looked ok, but the swf failed to find the font)
isu
mike at nux dot co dot uk
21-Dec-2000 12:22
I am using a Generator alternative Turbine - http://www.blue-pac.com - much cheaper than generator with a new version comming soon with builtin php support.
tbma at usa dot net
28-Oct-2000 11:32
Quick patch for php 4.0.2 to enable sound.

http://tbma.cjb.net/swf-sound/php-4.0.2-swf-sound.diff
ghisha at inwind dot it
06-Sep-2000 12:02
Writing on directory is not required. You can generate a run-time movie .. by replacing swf_openfile("<filename>", .... ) with swf_openfile("php://stdout", ....) and add before that an
Header("Content-type: application/x-shockwave-flash")
adobernig at netway dot at
12-Jul-2000 01:09
There are 2 prerequisites that must be met to run the test program:

1.) The directory where the test program resides in must be writeable to the PHP user (depending on installation either the apache user (module version of PHP4) or the script owner)

2.) The fonts directory from the swflib  distribution must be in the same dir as the test script file  so when the test file is  foo/swftest.php  the fonts dir should be  foo/fonts/ containing Mod.f and Mod.l   

Otherwise you will get a segfault when executing the test program.
kawa at gui dot uva dot es
06-Jul-2000 10:23
Fonts must be in the directory named "fonts". Lets see... if your code is in /www/swf.php4, you sould make a directory /www/fonts. If you use the example above, copy the files dist/fonts/Mod.f and dist/fonts/Mod.l of the source distribution to into /www/fonts/ to use the font Mod. I think you can use also SET_SWF_FONTS or similar

swf_actiongeturl" width="11" height="7"/> <wordwrap
Last updated: Mon, 05 Feb 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites