cvs: phpdoc /ja Translators /ja/chapters config.xml install.xml /ja/functions filesystem.xml ming.xml openssl.xml outcontrol.xml uodbc.xml

From: Date: Thu, 05 Apr 2001 15:09:17 +0000
Subject: cvs: phpdoc /ja Translators /ja/chapters config.xml install.xml /ja/functions filesystem.xml ming.xml openssl.xml outcontrol.xml uodbc.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969334910@lists.php.net to get a copy of this message
hirokawa Thu Apr 5 08:09:17 2001 EDT Added files: /phpdoc/ja/functions ming.xml Modified files: /phpdoc/ja Translators /phpdoc/ja/chapters config.xml install.xml /phpdoc/ja/functions filesystem.xml openssl.xml outcontrol.xml uodbc.xml Log: added ming.xml, update translation.

Index: phpdoc/ja/Translators diff -u phpdoc/ja/Translators:1.20 phpdoc/ja/Translators:1.21 --- phpdoc/ja/Translators:1.20 Sat Mar 10 21:57:43 2001 +++ phpdoc/ja/Translators Thu Apr 5 08:09:14 2001 @@ -71,6 +71,7 @@ functions/mcal.xml Rui Hirokawa functions/mcrypt.xml Rui Hirokawa functions/mhash.xml Rui Hirokawa +functions/ming.xml Rui Hirokawa functions/misc.xml Michihide Hotta functions/mnogosearch.xml Rui Hirokawa functions/mssql.xml Rui Hirokawa Index: phpdoc/ja/chapters/config.xml diff -u phpdoc/ja/chapters/config.xml:1.10 phpdoc/ja/chapters/config.xml:1.11 --- phpdoc/ja/chapters/config.xml:1.10 Tue Mar 13 14:11:11 2001 +++ phpdoc/ja/chapters/config.xml Thu Apr 5 08:09:15 2001 @@ -550,10 +550,9 @@ </term> <listitem> <para> - PHP タグの短縮型 (<userinput>&lt;? ?&gt;</userinput> を使用可能に - するかどうかを設定します。 - PHPをXMLと組み合わせて用いる場合は、このオプションを - オフにする必要があります。 + PHP タグの短縮型 (<userinput>&lt;? ?&gt;</userinput>) を使用 + 可能にするかどうかを設定します。PHPをXMLと組み合わせて用いる + 場合は、このオプションをオフにする必要があります。 これをオフにした場合、長い方の形式のタグ (<userinput>&lt;?php ?&gt;</userinput>)を使用する必要 があります。 Index: phpdoc/ja/chapters/install.xml diff -u phpdoc/ja/chapters/install.xml:1.29 phpdoc/ja/chapters/install.xml:1.30 --- phpdoc/ja/chapters/install.xml:1.29 Thu Mar 22 07:48:04 2001 +++ phpdoc/ja/chapters/install.xml Thu Apr 5 08:09:15 2001 @@ -361,7 +361,7 @@ $ cd /usr/ports/www/php4 $ make show VARNAME=FLAVORS (choose which flavors you want from the list) -$ make install FLAVOR="imap gettext ldap mysql gd pdflib" +$ FLAVOR="imap gettext ldap mysql gd pdflib" make install $ php4-enable </programlisting> </example> @@ -2216,6 +2216,20 @@ </listitem> </varlistentry> + <varlistentry id="install.configure.with-ming"> + <term> + <parameter>--with-ming</parameter> + </term> + <listitem> + <para> + PHP 3: このオプションは PHP 3 では利用できません。 + </para> + <para> + PHP 4: Ming による Flash 4 サポートを導入します。 + </para> + </listitem> + </varlistentry> + <varlistentry id="install.configure.with-swf"> <term> <parameter>--with-swf[=DIR]</parameter> @@ -2288,7 +2302,7 @@ <varlistentry id="install.configure.with-bzip2-dir"> <term> - <parameter>--with-bzip[=DIR]</parameter> + <parameter>--with-bz2[=DIR]</parameter> </term> <listitem> <para> Index: phpdoc/ja/functions/filesystem.xml diff -u phpdoc/ja/functions/filesystem.xml:1.29 phpdoc/ja/functions/filesystem.xml:1.30 --- phpdoc/ja/functions/filesystem.xml:1.29 Wed Mar 28 05:45:34 2001 +++ phpdoc/ja/functions/filesystem.xml Thu Apr 5 08:09:15 2001 @@ -2110,6 +2110,59 @@ </refsect1> </refentry> + <refentry id="function.pathinfo"> + <refnamediv> + <refname>pathinfo</refname> + <refpurpose>ファイルパスに関する情報を返す</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>pathinfo</function></funcdef> + <paramdef>string <parameter>path</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>pathinfo</function> は、<parameter>path</parameter> に + 関する情報を有する連想配列を返します。次の配列要素が返されます。 + <parameter>dirname</parameter>, <parameter>basename</parameter>, + <parameter>extension</parameter> + </para> + <para> + <example> + <title><function>pathinfo</function> の例</title> + <programlisting role="php"> +&lt;?php + +$path_parts = pathinfo("/www/htdocs/index.html"); + +echo $path_parts["dirname"] . "\n"; +echo $path_parts["basename"] . "\n"; +echo $path_parts["extension"] . "\n"; + +?&gt; + </programlisting> + </example> + </para> + <para> + 出力は次のようになります。 + <informalexample> + <programlisting> +/www/htdocs +index.html +html + </programlisting> + </informalexample> + </para> + <para> + <function>dirname</function>, + <function>basename</function>, <function>realpath</function> も参 + 照下さい。 + </para> + </refsect1> + </refentry> + <refentry id="function.pclose"> <refnamediv> <refname>pclose</refname> Index: phpdoc/ja/functions/openssl.xml diff -u phpdoc/ja/functions/openssl.xml:1.4 phpdoc/ja/functions/openssl.xml:1.5 --- phpdoc/ja/functions/openssl.xml:1.4 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/openssl.xml Thu Apr 5 08:09:16 2001 @@ -2,18 +2,271 @@ <title>OpenSSL 関数</title> <titleabbrev>OpenSSL</titleabbrev> <partintro> - <para> - このモジュールは、署名の生成および認証、そして、データのシール - (暗号化)およびオープン(復号化)を行うために、<ulink - url="&url.openssl;">OpenSSL</ulink> の関数を使用します。このモジュー - ルでは、OpenSSL >= 0.9.6 を使用する必要があります。 - </para> - <para> - OpenSSL は多くの機能を提供しますが、これらはまだこのモジュールでは - サポートされていません。 - </para> + <sect1 id="openssl.intro"> + <title>導入</title> + <para> + このモジュールは、署名の生成および認証、そして、データのシール + (暗号化)およびオープン(復号化)を行うために、 + <ulink url="&url.openssl;">OpenSSL</ulink> の関数を使用します。こ + のモジュールでは、PHP 4.0.4pl1 は、OpenSSL >= 0.9.6 を必要としま + すが、PHP-4.0.5以降では、OpenSSL &gt;= 0.9.5 でも動作します。 + </para> + <note> + <para> + この拡張モジュールはまだ実験的なものであることに注意して下さい! + </para> + </note> + <para> + OpenSSL は多くの機能を提供しますが、これらはまだこのモジュールでは + サポートされていません。 + </para> + </sect1> + <sect1 id="openssl.certparams"> + <title>キー/証明書パラメータ</title> + <para> + OpenSSL関数のうちごく小数のみがキーまたは証明書パラメータを必要と + します。PHP 4.0.5 より以前では、openssl_get_xxx 関数のどれかによ + り返されたキーまたは証明書リソースを使用する必要がありました。こ + れより後のバージョンでは、次の方法のどれかを使用することが可能と + なる予定です。 + <itemizedlist> + <listitem> + <para> + 証明書 + <orderedlist> + <listitem> + <simpara> + openssl_x509_read から返された X.509リソース + </simpara> + </listitem> + <listitem> + <simpara> + <filename>file://path/to/cert.pem</filename> 形式の文字列。 + このファイルは、PEMエンコードの証明書である必要があります。 + </simpara> + </listitem> + <listitem> + <simpara> + PEMエンコードされた証明書の内容を含む文字列。 + </simpara> + </listitem> + </orderedlist> + </para> + </listitem> + <listitem> + <para> + 公開/秘密キー + <orderedlist> + <listitem> + <simpara> + <function>openssl_get_publickey</function> または + <function>openssl_get_privatekey</function> から返されたキー + リソース + </simpara> + </listitem> + <listitem> + <simpara> + 公開キーのみ: X.509リソース + </simpara> + </listitem> + <listitem> + <simpara> + <filename>file://path/to/file.pem</filename> フォーマットを + 有する文字列。このファイルには、PEMエンコードされた証明書/ + 秘密キーが含まれている必要があります。(両方を含むことも可能 + です。) + </simpara> + </listitem> + <listitem> + <simpara> + PEMエンコードされた証明書/キーの内容を含む文字列 + </simpara> + </listitem> + <listitem> + <simpara> + 秘密キーについては、<emphasis>array($key, + $passphrase)</emphasis> という構文を使用することも可能です。 + ただし、$key は、file:// または上記のテキスト表現形式を使用 + して指定したキー、$passphrase はその秘密キーに関するパスワー + ドを有する文字列を表します。 + </simpara> + </listitem> + </orderedlist> + </para> + </listitem> + </itemizedlist> + </para> + </sect1> + + <sect1 id="openssl.cert.verification"> + <title>証明書の認証</title> + <para> + サイン/証明書を認証する関数をコールする際、 + <emphasis>cainfo</emphasis> パラメータは、ファイルと認証済みのCA + ファイルの場所を指定するファイルディレクトリ名を含む配列です。 + ディレクトリが指定された場合、<command>openssl</command>コマンド + が使用できるような正しい形式にハッシュされたディレクトリである必 + 要があります。 + </para> + </sect1> + <sect1 id="openssl.pkcs7.flags"> + <title>PKCS7 フラグ/定数</title> + <para> + S/MIME 関数はビットフィールドを使用して指定したフラグを使用します。 + このビットフィールドには、以下の値を一つ以上含むことが可能です。 + + <table> + <title>PKCS7 定数</title> + <tgroup cols="2"> + <thead> + <row> + <entry>定数</entry> + <entry>説明</entry> + </row> + </thead> + <tbody> + <row> + <entry>PKCS7_TEXT</entry> + <entry> + text/plain content type ヘッダを暗号化/サインを行うメッセー + ジに追加します。復号化または認証を行う際には、このヘッダは出 + 力から取り除かれます。復号化または認証されたメッセージがMIME + 型 text/plain でない場合、エラーとなります。 + </entry> + </row> + <row> + <entry>PKCS7_BINARY</entry> + <entry> + 通常、入力されたメッセージは、CRおよびLFを行端として使用した + 「正規化」された形式に変換されます。この形式は、S/MIME規格に + 基づくものです。このオプションが指定された場合、変換が行われ + ます。この機能は、MIME形式でないバイナリデータを処理する際に + 便利です。 + </entry> + </row> + <row> + <entry>PKCS7_NOINTERN</entry> + <entry> + メッセージを認証する際に、通常、メッセージに含まれる証明書が + 証明書にサインする際に検索されます。 + このオプションでは、 + <function>openssl_pkcs7_verify</function> の + <parameter>extracerts</parameter> パラメータで指定した証明書 + のみが使用されます。しかし、指定された証明書を信頼されていな + いCAとして使用することも可能です。 + </entry> + </row> + <row> + <entry>PKCS7_NOVERIFY</entry> + <entry> + サイン済みのメッセージにサインした人の証明書を認証しません。 + </entry> + </row> + <row> + <entry>PKCS7_NOCHAIN</entry> + <entry> + サインを行った側の証明書の認証の連鎖を行いません。 + この場合、サイン付きのメッセージにある証明書を未認証のCAとし + て使用しません。 + </entry> + </row> + <row> + <entry>PKCS7_NOCERTS</entry> + <entry> + メッセージにサインする際、通常サインをする人の証明書が挿入さ + れます。このオプションを指定した場合はそうなりません。これに + より、サイン付きのメッセージのサイズは小さくなりますが、認証 + 側が、(例えば、<function>openssl_pkcs7_verify</function>の + <parameter>extracerts</parameter>により渡すことにより)サイン + をした人の証明書のコピーをローカルに用意する必要があります。 + </entry> + </row> + <row> + <entry>PKCS7_NOATTR</entry> + <entry> + 通常、メッセージがサインされる時、サインした時間やサポートさ + れる対象アルゴリズムを含む一連の属性が付加されます。このオプ + ションを指定した場合、それらの属性は付加されません。 + </entry> + </row> + <row> + <entry>PKCS7_DETACHED</entry> + <entry> + メッセージにサインをする際、MIME型 multipart/signed を指定し + てクリアテキストでサインを行います。これは、 + <function>openssl_pkcs7_sign</function> において + フラグを指定しなかった場合の <parameter>flags</parameter> パ + ラメータのデフォルトです。このオプションをオフにした場合、メッ + セージは不透明なサインによりサインされます。これは、メールリ + レイによる変換に対してより耐性がありますが、S/MIMEをサポート + しないメールエージェントでは読むことはできません。 + </entry> + </row> + <row> + <entry>PKCS7_NOSIGS</entry> + <entry> + メッセージにサインや認証を試みません。 + </entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <note> + <para> + これらの定数は、4.0.6 で追加されました。 + </para> + </note> + </sect1> </partintro> + <refentry id="function.openssl-error-string"> + <refnamediv> + <refname>openssl_error_string</refname> + <refpurpose>OpenSSL エラーメッセージを返す</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>openssl_error_string</function></funcdef> + <paramdef>void<parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + エラーメッセージ文字列を返します。返すべきエラーメッセージがもう + ない場合は、false を返します。 + </para> + <para> + <function>openssl_error_string</function> は、OpenSSL ライブラリ + から直近のエラーを返します。エラーメッセージはスタックにつまれて + おり、全て情報を集めるには、この関数を複数回コールする必要があり + ます。 + </para> + <para> + <emphasis> + この関数のパラメータ/返り値の型は、PHPのリリース版が公開される前 + に変更される可能性があります。 + </emphasis> + </para> + <para> + <example> + <title><function>openssl_error_string</function> の例</title> + <programlisting role="php"> +// ここで処理に失敗するOpenSSL関数をコールしたと仮定します +while($msg = openssl_error_string) + echo $msg . "&lt;br&gt;"; + </programlisting> + </example> + </para> + <note> + <para> + これらの定数は、4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.openssl-free-key"> <refnamediv> <refname>openssl_free_key</refname> @@ -24,7 +277,7 @@ <funcsynopsis> <funcprototype> <funcdef>void <function>openssl_free_key</function></funcdef> - <paramdef>int <parameter>key_identifier</parameter></paramdef> + <paramdef>resource <parameter>key_identifier</parameter></paramdef> </funcprototype> </funcsynopsis> <para> @@ -44,8 +297,8 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>openssl_get_privatekey</function></funcdef> - <paramdef>string <parameter>key</parameter></paramdef> + <funcdef>resource <function>openssl_get_privatekey</function></funcdef> + <paramdef>mixed <parameter>key</parameter></paramdef> <paramdef>string <parameter> <replaceable><optional>passphrase</optional></replaceable> @@ -54,7 +307,7 @@ </funcprototype> </funcsynopsis> <para> - 成功時に正のキーID、エラー時にfalseを返します。 + 成功時に正のキーリソースID、エラー時にfalseを返します。 </para> <para> <function>openssl_get_privatekey</function> は、 @@ -77,12 +330,12 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>openssl_get_publickey</function></funcdef> - <paramdef>string <parameter>certificate</parameter></paramdef> + <funcdef>resource <function>openssl_get_publickey</function></funcdef> + <paramdef>mixed <parameter>certificate</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - 成功時に公開キー、エラー時にfalseを返します。 + 成功時に正のキーリソースID、エラー時にfalseを返します。 </para> <para> <function>openssl_get_publickey</function> は、 @@ -105,7 +358,7 @@ <paramdef>string <parameter>sealed_data</parameter></paramdef> <paramdef>string <parameter>open_data</parameter></paramdef> <paramdef>string <parameter>env_key</parameter></paramdef> - <paramdef>int <parameter>priv_key_id</parameter></paramdef> + <paramdef>mixed <parameter>priv_key_id</parameter></paramdef> </funcprototype> </funcsynopsis> <para> @@ -280,7 +533,7 @@ <funcdef>int <function>openssl_verify</function></funcdef> <paramdef>string <parameter>data</parameter></paramdef> <paramdef>string <parameter>signature</parameter></paramdef> - <paramdef>int <parameter>pub_key_id</parameter></paramdef> + <paramdef>mixed <parameter>pub_key_id</parameter></paramdef> </funcprototype> </funcsynopsis> <para> @@ -326,6 +579,510 @@ </simpara> </refsect1> </refentry> + + <refentry id="function.openssl-pkcs7-decrypt"> + <refnamediv> + <refname>openssl_pkcs7_decrypt</refname> + <refpurpose>S/MIME 暗号化されたメッセージを復号化する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>openssl_pkcs7_decrypt</function></funcdef> + <paramdef>string <parameter>infilename</parameter></paramdef> + <paramdef>string <parameter>outfilename</parameter></paramdef> + <paramdef>mixed <parameter>recipcert</parameter></paramdef> + <paramdef>mixed <parameter>recipkey</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>infilename</parameter>で指定したファイル中のS/MIME暗号 + 化されたメッセージを、<parameter>recipcert</parameter> および + <parameter>recipkey</parameter> で指定した証明書と公開キーを用い + て復号化します。 + </para> + <para> + 復号化されたメッセージは、<parameter>outfilename</parameter>で指 + 定したファイルに出力されます。 + </para> + <para> + <emphasis> + この関数のパラメータ/返り値は、PHPのリリース版が公開されるまでに + 変更される可能性があります。 + </emphasis> + </para> + <para> + <example> + <title><function>openssl_pkcs7_decrypt</function> の例</title> + <programlisting role="php"> +// $cert および $key にはあなたの個人証明書と公開キーが含まれており、 +// あなたはS/MIMEメッセージの受信者であると仮定します。 +$infilename = "encrypted.msg"; // 暗号化されたメッセージを含むファイル +$outfilename = "decrypted.msg"; // このファイルへの書き込み権限が必要 + +if (openssl_pkcs7_decrypt($infilename, $outfilename, $cert, $key)) + echo "復号化されました!"; +else + echo "復号化に失敗しました!"; + + </programlisting> + </example> + </para> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.openssl-pkcs7-encrypt"> + <refnamediv> + <refname>openssl_pkcs7_encrypt</refname> + <refpurpose>S/MIME メッセージを暗号化する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>openssl_pkcs7_encrypt</function></funcdef> + <paramdef>string <parameter>infilename</parameter></paramdef> + <paramdef>string <parameter>outfilename</parameter></paramdef> + <paramdef>mixed <parameter>recipcerts</parameter></paramdef> + <paramdef>array <parameter>headers</parameter></paramdef> + <paramdef>long + <parameter><optional>flags</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>openssl_pkcs7_encrypt</function> は、 + <parameter>infilename</parameter> という名前のファイルの内容を + RC2 40ビット暗号により暗号化します。この内容は、 + <parameter>recipcerts</parameter> で指定した意図する受信者によっ + てのみ読むことが可能です。<parameter>recipcerts</parameter> は、 + X.509 証明書または X.509 証明書の配列です。 + <parameter>headers</parameter> は、暗号化された後にデータの前に付 + 加されるヘッダの配列です。<parameter>flags</parameter> はオプショ + ンとして使用可能であり、エンコード処理を変更するために指定されま + す。<link linkend="openssl.pkcs7.flags">PKCS7定数</link>を参照下 + さい。<parameter>headers</parameter> は、ヘッダ名をキーとする連想 + 配列または添字配列であり、各要素には、各ヘッダ行が一行ずつ含まれ + ています。 + </para> + <para> + <emphasis> + この関数のパラメータ/返り値は、PHPのリリース版が公開されるまでに + 変更される可能性があります。 + </emphasis> + </para> + <para> + <example> + <title><function>openssl_pkcs7_encrypt</function> の例</title> + <programlisting role="php"> +// 暗号化するメッセージを nighthawk という名前の外部の秘密のエー +// ジェントに送信します。送信先の証明書をファイル nighthawk.pem に有し +// ています。 +$data = &lt;&lt;&lt;EOD +Nighthawk, + +Top secret, for your eyes only! + +The enemy is closing in! Meet me at the cafe at 8.30am +to collect your forged passport! + +HQ +EOD; +// ファイルにメッセージを保存 +$fp = fopen("msg.txt", "w"); +fwrite($fp, $data); +fclose($fp); +// メッセージを暗号化 +if (openssl_pkcs7_encrypt("msg.txt", "enc.txt", "nighthawk.pem", + array("To" =&gt; "nighthawk@agent.com", // 連想配列の構文 + "From: HQ &lt;hq@cia.com&gt;", // 添字配列の構文 + "Subject" =&gt; "Eyes only"))) +{ + // メッセージを暗号化し、送信します! + exec(ini_get("sendmail_path") . " &lt; enc.txt"); +} + </programlisting> + </example> + </para> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.openssl-pkcs7-sign"> + <refnamediv> + <refname>openssl_pkcs7_sign</refname> + <refpurpose>S/MIME メッセージにサインする</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>openssl_pkcs7_sign</function></funcdef> + <paramdef>string <parameter>infilename</parameter></paramdef> + <paramdef>string <parameter>outfilename</parameter></paramdef> + <paramdef>mixed <parameter>signcert</parameter></paramdef> + <paramdef>mixed <parameter>privkey</parameter></paramdef> + <paramdef>array <parameter>headers</parameter></paramdef> + <paramdef>long + <parameter><optional>flags</optional></parameter></paramdef> + <paramdef>string + <parameter><optional>extracertsfilename</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>openssl_pkcs7_sign</function> takes the contents of the + file named <parameter>infilename</parameter> and signs them using + the certificate and it's matching private key specified by + <parameter>signcert</parameter> and <parameter>privkey</parameter> + parameters. + </para> + <para> + <parameter>headers</parameter> is an array of headers that + will be prepended to the data after it has been signed (see + <function>openssl_pkcs7_encrypt</function> for more information about + the format of this parameter. + </para> + <para> + <parameter>flags</parameter> can be used to alter the output - see <link + linkend="openssl.pkcs7.flags">PKCS7 constants</link> - if not specified, + it defaults to PKCS7_DETACHED. + </para> + <para> + <parameter>extracerts</parameter> specifies the name of a file containing + a bunch of extra certificates to include in the signature which can for + example be used to help the recipient to verify the certificate that you used. + </para> + <para> + <emphasis> + The parameters/return type of this function may change before + it appears in a release version of PHP + </emphasis> + </para> + + <para> + <example> + <title><function>openssl_pkcs7_sign</function> の例</title> + <programlisting role="php"> +// the message you want to sign so that recipient can be sure it was you that +// sent it +$data = &lt;&lt;&lt;EOD + +You have my authorization to spend $10,000 on dinner expenses. + +The CEO +HQ +EOD; +// save message to file +$fp = fopen("msg.txt", "w"); +fwrite($fp, $data); +fclose($fp); +// encrypt it +if (openssl_pkcs7_sign("msg.txt", "signed.txt", "mycert.pem", + array("mycert.pem", "mypassphrase"), + array("To" =&gt; "joes@sales.com", // keyed syntax + "From: HQ &lt;ceo@sales.com&gt;", // indexed syntax + "Subject" =&gt; "Eyes only")) +{ + // message signed - send it! + exec(ini_get("sendmail_path") . " &lt; signed.txt"); +} + </programlisting> + </example> + </para> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.openssl-pkcs7-verify"> + <refnamediv> + <refname>openssl_pkcs7_verify</refname> + <refpurpose>S/MIMEサインされたメッセージのサインを確認する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>openssl_pkcs7_verify</function></funcdef> + <paramdef>string <parameter>filename</parameter></paramdef> + <paramdef>int <parameter>flags</parameter></paramdef> + <paramdef>string + <parameter><optional>outfilename</optional></parameter> + </paramdef> + <paramdef>array + <parameter><optional>cainfo</optional></parameter> + </paramdef> + <paramdef>string + <parameter><optional>extracerts</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>openssl_pkcs7_verify</function> reads the S/MIME message + contained in the filename specified by + <parameter>filename</parameter> and + examines the digital signature. It returns true if the signature + is verified, false if it is not correct (the message has been + tampered with, + or the signing certificate is invalid), or -1 on error. + </para> + <para> + <parameter>flags</parameter> can be used to affect how the signature is + verified - see <link linkend="openssl.pkcs7.flags">PKCS7 constants</link> + for more information. + </para> + <para> + If the <parameter>outfilename</parameter> is specified, it should be a + string holding the name of a file into which the certificates of the + persons that signed the messages will be stored in PEM format. + </para> + <para> + If the <parameter>cainfo</parameter> is specified, it should hold + information about the trusted CA certificates to use in the verification + process - see <link linkend="openssl.cert.verification">certificate + verification</link> for more information about this parameter. + </para> + <para> + If the <parameter>extracerts</parameter> is specified, it is the filename + of a file containing a bunch of certificates to use as untrusted CAs. + </para> + <para> + <emphasis> + The parameters/return type of this function may change before + it appears in a release version of PHP + </emphasis> + </para> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.openssl-x509-checkpurpose"> + <refnamediv> + <refname>openssl_x509_checkpurpose</refname> + <refpurpose> + 証明書が特定の目的に使用可能かどうか確認します。 + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>openssl_x509_checkpurpose</function></funcdef> + <paramdef>mixed <parameter>x509cert</parameter></paramdef> + <paramdef>int <parameter>purpose</parameter></paramdef> + <paramdef>array <parameter>cainfo</parameter></paramdef> + <paramdef>string + <parameter><optional>untrustedfile</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + 証明書が意図した目的に使用可能である場合に true、使用できない場合 + に false 、エラーの場合に -1 を返します。 + </para> + <para> + <function>openssl_x509_checkpurpose</function> は、証明書 + <parameter>x509cert</parameter> を調べ、 + <parameter>purpose</parameter> で指定した目的に使用可能であるかど + うかを確認します。 + </para> + <para> + <parameter>cainfo</parameter> は、<link + linkend="openssl.cert.verification">証明書の認証</link> で説明し + たような信頼できるCAファイル/ディレクトリの配列です。 + </para> + <para> + <parameter>untrustedfile</parameter>, if specified, + is the name of a PEM encoded file holding certificates that can + be used to + help verify the certificate, although no trust in placed in the + certificates that come from that file. + </para> + <para> + <emphasis> + The parameters/return type of this function may change before + it appears in a release version of PHP + </emphasis> + </para> + <para> + <table> + <title><function>openssl_x509_checkpurpose</function> の目的</title> + <tgroup cols="2"> + <thead> + <row> + <entry>定数</entry> + <entry>説明</entry> + </row> + </thead> + <tbody> + <row> + <entry>X509_PURPOSE_SSL_CLIENT</entry> + <entry> + Can the certificate be used for the client side of an SSL + connection? + </entry> + </row> + <row> + <entry>X509_PURPOSE_SSL_SERVER</entry> + <entry> + Can the certificate be used for the server side of an SSL + connection? + </entry> + </row> + <row> + <entry>X509_PURPOSE_NS_SSL_SERVER</entry> + <entry> + Can the cert be used for Netscape SSL server? + </entry> + </row> + <row> + <entry>X509_PURPOSE_SMIME_SIGN</entry> + <entry> + Can the cert be used to sign S/MIME email? + </entry> + </row> + <row> + <entry>X509_PURPOSE_SMIME_ENCRYPT</entry> + <entry>Can the cert be used to encrypt S/MIME email?</entry> + </row> + <row> + <entry>X509_PURPOSE_CRL_SIGN</entry> + <entry> + Can the cert be used to sign a certificate revocation list + (CRL)? + </entry> + </row> + <row> + <entry>X509_PURPOSE_ANY</entry> + <entry> + Can the cert be used for Any/All purposes? + </entry> + </row> + </tbody> + </tgroup> + </table> + これらのオプションはビットフィールドではありません。一つだけ指定 + することが可能です! + </para> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.openssl-x509-free"> + <refnamediv> + <refname>openssl_x509_free</refname> + <refpurpose>証明書リソースを開放する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>openssl_x509_free</function></funcdef> + <paramdef>resource <parameter>x509cert</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>openssl_x509_free</function> は、メモリから指定した + <parameter>x509cert</parameter> リソースに関連した証明書を開放し + ます。 + </para> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.openssl-x509-parse"> + <refnamediv> + <refname>openssl_x509_parse</refname> + <refpurpose> + Parse an X509 証明書をパースし、配列として情報を返す + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>openssl_x509_parse</function></funcdef> + <paramdef>mixed <parameter>x509cert</parameter></paramdef> + <paramdef>bool + <parameter><optional>shortnames</optional></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>openssl_x509_parse</function> returns information about the + supplied <parameter>x509cert</parameter>, including fields such as subject + name, issuer name, purposes, valid from and valid to dates etc. + <parameter>shortnames</parameter> controls how the data is indexed in the + array - if <parameter>shortnames</parameter> is true (the default) then + fields will be indexed with the short name form, otherwise, the long name + form will be used - e.g.: CN is the shortname form of commonName. + </para> + <para> + <emphasis> + The structure of the returned data is (deliberately) not + yet documented, as it is still subject to change. + </emphasis> + </para> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.openssl-x509-read"> + <refnamediv> + <refname>openssl_x509_read</refname> + <refpurpose> + Parse an X.509 証明書をパースし、リソースIDを返す + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>resource <function>openssl_x509_read</function></funcdef> + <paramdef>mixed <parameter>x509certdata</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>openssl_x509_read</function> は、 + <parameter>x509certdata</parameter> で指定した証明書をパースし、 + その証明書用のリソースIDを返します。 + </para> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> </reference> <!-- Keep this comment at the end of the file @@ -343,4 +1100,7 @@ sgml-local-catalogs:nil sgml-local-ecat-files:nil End: +--> +<!-- Keep this comment for vi/vim/gvim +vi: et:ts=1:sw=1:textwidth=78 --> Index: phpdoc/ja/functions/outcontrol.xml diff -u phpdoc/ja/functions/outcontrol.xml:1.7 phpdoc/ja/functions/outcontrol.xml:1.8 --- phpdoc/ja/functions/outcontrol.xml:1.7 Sun Feb 18 15:29:44 2001 +++ phpdoc/ja/functions/outcontrol.xml Thu Apr 5 08:09:16 2001 @@ -271,7 +271,7 @@ <example> <title><function>ob_gzhandler</function> の例</title> <programlisting role="php"> -&lt;php +&lt;?php ob_start("ob_gzhandler"); Index: phpdoc/ja/functions/uodbc.xml diff -u phpdoc/ja/functions/uodbc.xml:1.11 phpdoc/ja/functions/uodbc.xml:1.12 --- phpdoc/ja/functions/uodbc.xml:1.11 Thu Mar 15 04:22:10 2001 +++ phpdoc/ja/functions/uodbc.xml Thu Apr 5 08:09:16 2001 @@ -371,7 +371,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>odbc_error</function></funcdef> + <funcdef>string <function>odbc_error</function></funcdef> <paramdef>int <parameter><optional>connection_id</optional></parameter> </paramdef> @@ -399,7 +399,7 @@ <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>odbc_errormsg</function></funcdef> + <funcdef>string <function>odbc_errormsg</function></funcdef> <paramdef>int <parameter><optional>connection_id</optional></parameter> </paramdef> Index: phpdoc/ja/functions/ming.xml +++ phpdoc/ja/functions/ming.xml <reference id="ref.ming"> <title>Flash 用 Ming 関数</title> <titleabbrev>Ming (flash)</titleabbrev> <partintro> <sect1 id="ming.intro"> <title>導入</title> <simpara> Ming は、SWF("Flash")フォーマットのムービーを作成するためのオープ ンソース(LGPL)のライブラリです。Ming は、シェープ、グラディエント、 ビットマップ(PNGおよびJPEG)、モーフィング、テキスト、ボタン、アク ション、スプライト("ムービークリップ")、mp3 のストリーム出力、色 変換といったFlash 4の機能のほとんど全てをサポートしています。現在、 未サポートなのは、サウンド関係のイベントのみです。 </simpara> <simpara> Ming は、短縮語ではありません。 </simpara> <simpara> 長さ、距離、大きさ等を指定する値は全て "twips" つまり、20ユニット /ピクセル単位であることに注意して下さい。しかし、実際には、Flash プレイヤーがムービーをembed/object タグで指定したピクセルサイズま たはembedされていない場合はフレーム全体にスケーリングするため、任 意のサイズになります。 </simpara> <simpara> Ming は、既存の PHP/libswf モジュールに対して多くの点で優れていま す。Ming は、そのコードをコンパイルできる環境でならどこでも使用す ることが可能です。一方、libswf のソースコードは公開されておらず、 ごくわずかなプラットフォームでのみ利用可能です。Windowsは、libswf でサポートされるプラットフォームには入っていません。Ming は、ムー ビーの要素をPHPオブジェクト内に隠蔽することにより、SWFファイルフォー マットの細部を直接取り扱うことを回避しています。また、Ming はメン テナンスが継続されています。使用したい機能がある場合には、我々、 <ulink url="mailto:&email.ming;">&email.ming;</ulink> まで知らせ て下さい。 </simpara> <simpara> Ming は、PHP 4.0.5 で追加されました。 </simpara> </sect1> <sect1 id="ming.install"> <title>インストール</title> <para> Ming を PHP で使用するには、まず、Ming ライブラリを構築し、インス トールする必要があります。ソースコードとインストール手引が、Ming のホームページ <ulink url="&url.ming;">&url.ming;</ulink> から入 手可能です。ここには、例や簡単なチュートリアル、最新のニュースも あります。 </para> <para> ming のアーカイブをダウンロードし、展開して下さい。Ming ディレク トリに移動し、make、make install を実行して下さい。 </para> <para> これにより、<filename>libming.so</filename> が構築され、 <filename>/usr/lib/</filename> にインストールされます。また、 <filename>ming.h</filename> が <filename>/usr/include/</filename> にコピーされます。インストールされるディレクトリを変更するには、 <filename>Makefile</filename> の <literal>PREFIX=</literal> の行 を編集して下さい。 </para> <sect2 id="ming.install.php.unix"> <title>PHP (unix) に組み込む</title> <para> <literallayout> mkdir &lt;phpdir>/ext/ming cp php_ext/* &lt;phpdir>/ext/ming cd &lt;phpdir> ./buildconf ./configure --with-ming &lt;other config options&gt; </literallayout> PHP を通常と同様に構築、インストールして下さい。必要ならば Web サーバを再起動して下さい。 </para> </sect2> <sect2 id="ming.install.php_module.unix"> <title>PHP モジュールをインストールする (unix)</title> <para> <filename>php_ming.so.gz</filename> をダウンロードして下さい。こ れを解凍し、PHPモジュール用ディレクトリにコピーして下さい。 (PHPモジュール用ディレクトリは、<command>php-config --extension-dir</command> を実行することにより見つけられます。 ここで、<literal>extension=php_ming.so</literal> を <filename>php.ini</filename> ファイルに追加するか、 <literal>dl('php_ming.so');</literal> を全ての Ming スクリプトの 先頭に追加して下さい。 </para> </sect2> </sect1> <sect1 id="ming.use"> <title>Mingの使用法</title> <simpara> Ming は、PHP に13個の新規オブジェクトを追加します。これらは全て、 メソッドと属性を有しています。これらを使用するには、<link linkend="language.oop">オブジェクト</link> について知る必要があり ます。 </simpara> <itemizedlist> <listitem> <simpara> <function>swfmovie</function>. </simpara> </listitem> <listitem> <simpara> <function>swfshape</function>. </simpara> </listitem> <listitem> <simpara> <function>swfdisplayitem</function>. </simpara> </listitem> <listitem> <simpara> <function>swfgradient</function>. </simpara> </listitem> <listitem> <simpara> <function>swfbitmap</function>. </simpara> </listitem> <listitem> <simpara> <function>swffill</function>. </simpara> </listitem> <listitem> <simpara> <function>swfmorph</function>. </simpara> </listitem> <listitem> <simpara> <function>swftext</function>. </simpara> </listitem> <listitem> <simpara> <function>swffont</function>. </simpara> </listitem> <listitem> <simpara> <function>swftextfield</function>. </simpara> </listitem> <listitem> <simpara> <function>swfsprite</function>. </simpara> </listitem> <listitem> <simpara> <function>swfbutton</function>. </simpara> </listitem> <listitem> <simpara> <function>swfaction</function>. </simpara> </listitem> </itemizedlist> </sect1> </partintro> <!-- SWFMovie --> <refentry id="function.swfmovie"> <refnamediv> <refname>SWFMovie</refname> <refpurpose> SWFバージョン4ムービー形式で新規ムービーオブジェクトを作成する </refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfmovie</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie</function> は、SWFバージョン4ムービー形式で新た にムービーオブジェクトを作成します。 </para> <simpara> SWFMovie には、次のようなメソッドがあります。 <function>swfmovie->output</function>,<function>swfmovie->save</function>, <function>swfmovie->add</function>, <function>swfmovie->remove</function>, <function>swfmovie->nextframe</function>, <function>swfmovie->setbackground</function>, <function>swfmovie->setrate</function>, <function>swfmovie->setdimension</function>, <function>swfmovie->setframes</function>, <function>swfmovie->streammp3</function> </simpara> <simpara> <function>swfdisplayitem->rotateto</function>, <function>swfshape->setline</function>, <function>swfshape->addfill</function> 等の例も参照下さい。 これらの例は全てこのオブジェクトを使用しています。 </simpara> </refsect1> </refentry> <refentry id="function.swfmovie.output"> <refnamediv> <refname>SWFMovie->output</refname> <refpurpose>Dumps your lovingly prepared movie out.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->output</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->output</function> dumps your lovingly prepared movie out. In PHP, preceding this with the command <programlisting role="php"> &lt;?php header('Content-type: application/x-shockwave-flash'); ?&gt; </programlisting> convinces the browser to display this as a flash movie. </para> <simpara> See also <function>swfmovie->save</function> </simpara> <simpara> See examples in : <function>swfmovie->streammp3</function>, <function>swfdisplayitem->rotateto</function>, <function>swfaction</function>... Any example will use this method. </simpara> </refsect1> </refentry> <refentry id="function.swfmovie.save"> <refnamediv> <refname>SWFMovie->save</refname> <refpurpose>Saves your movie in a file.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->save</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->save</function> saves your movie to the file named <parameter>filename</parameter>. </para> <simpara> See also <function>output</function> </simpara> </refsect1> </refentry> <refentry id="function.swfmovie.add"> <refnamediv> <refname>SWFMovie->add</refname> <refpurpose>Adds any type of data to a movie.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->add</function></funcdef> <paramdef>ressource <parameter>instance</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->add</function> adds <parameter>instance</parameter> to the current movie. <parameter>instance</parameter> is any type of data : Shapes, text, fonts, etc. must all be add'ed to the movie to make this work. </para> <para> For displayable types (shape, text, button, sprite), this returns an <function>SWFDisplayItem</function>, a handle to the object in a display list. Thus, you can add the same shape to a movie multiple times and get separate handles back for each separate instance. </para> <simpara> See also all other objects (adding this later), and <function>swfmovie->remove</function> </simpara> <simpara> See examples in : <function>swfdisplayitem->rotateto</function> and <function>swfshape->addfill</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfmovie.remove"> <refnamediv> <refname>SWFMovie->remove</refname> <refpurpose>Removes the object instance from the display list.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->remove</function></funcdef> <paramdef>ressource <parameter>instance</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->remove</function> removes the object instance <parameter>instance</parameter> from the display list. </para> <simpara> See also <function>swfmovie->add</function> </simpara> </refsect1> </refentry> <refentry id="function.swfmovie.setbackground"> <refnamediv> <refname>SWFMovie->setbackground</refname> <refpurpose>Sets the background color.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->setbackground</function></funcdef> <paramdef>int <parameter>red</parameter></paramdef> <paramdef>int <parameter>green</parameter></paramdef> <paramdef>int <parameter>blue</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->setbackground</function> sets the background color. Why is there no rgba version? Think about it. (Actually, that's not such a dumb question after all- you might want to let the html background show through. There's a way to do that, but it only works on IE4. Search the <ulink url="&url.macromedia;">&url.macromedia;</ulink> site for details.) </para> </refsect1> </refentry> <refentry id="function.swfmovie.setrate"> <refnamediv> <refname>SWFMovie->setrate</refname> <refpurpose>Sets the animation's frame rate.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->setrate</function></funcdef> <paramdef>int <parameter>rate</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>nom_de_la_fonction</function> sets the frame rate to <parameter>rate</parameter>, in frame per seconds. Animation will slow down if the player can't render frames fast enough- unless there's a streaming sound, in which case display frames are sacrificed to keep sound from skipping. </para> </refsect1> </refentry> <refentry id="function.swfmovie.setdimension"> <refnamediv> <refname>SWFMovie->setdimension</refname> <refpurpose>Sets the movie's width and height.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->setdimension</function></funcdef> <paramdef>int <parameter>width</parameter></paramdef> <paramdef>int <parameter>height</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->setdimension</function> sets the movie's width to <parameter>width</parameter> and height to <parameter>height</parameter>. </para> </refsect1> </refentry> <refentry id="function.swfmovie.setframes"> <refnamediv> <refname>SWFMovie->setframes</refname> <refpurpose>Sets the total number of frames in the animation.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->setframes</function></funcdef> <paramdef>string <parameter>numberofframes</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->setframes</function> sets the total number of frames in the animation to <parameter>numberofframes</parameter>. </para> </refsect1> </refentry> <refentry id="function.swfmovie.nextframe"> <refnamediv> <refname>SWFMovie->nextframe</refname> <refpurpose>アニメーションの次フレームに移動</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->nextframe</function></funcdef> <paramdef>void </paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->setframes</function> moves to the next frame of the animation. </para> </refsect1> </refentry> <refentry id="function.swfmovie.streammp3"> <refnamediv> <refname>SWFMovie->streammp3</refname> <refpurpose>MP3 ファイルへのストリーム</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfmovie->streammp3</function></funcdef> <paramdef>string <parameter>mp3FileName</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmovie->streammp3</function> streams the mp3 file <parameter>mp3FileName</parameter>. Not very robust in dealing with oddities (can skip over an initial ID3 tag, but that's about it). Like <function>SWFShape->addJpegFill</function>, this isn't a stable function- we'll probably need to make a separate SWFSound object to contain sound types. </para> <para> Note that the movie isn't smart enough to put enough frames in to contain the entire mp3 stream- you'll have to add (length of song * frames per second) frames to get the entire stream in. </para> <para> Yes, now you can use ming to put that rock and roll devil worship music into your SWF files. Just don't tell the RIAA. <example> <title><function>swfmovie->streammp3</function> の例</title> <programlisting role="php"> &lt;?php $m = new SWFMovie(); $m-&gt;setRate(12.0); $m-&gt;streamMp3("distortobass.mp3"); // use your own MP3 // 11.85 seconds at 12.0 fps = 142 frames $m-&gt;setFrames(142); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <!-- SWFDisplayItem --> <refentry id="function.swfdisplayitem"> <refnamediv> <refname>SWFDisplayItem</refname> <refpurpose>Creates a new displayitem object.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfdisplayitem</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem</function> creates a new swfdisplayitem object. </para> <para> Here's where all the animation takes place. After you define a shape, a text object, a sprite, or a button, you add it to the movie, then use the returned handle to move, rotate, scale, or skew the thing. </para> <simpara> SWFDisplayItem has the following methods : <function>swfdisplayitem->move</function>, <function>swfdisplayitem->moveto</function>, <function>swfdisplayitem->scaleto</function>, <function>swfdisplayitem->scale</function>, <function>swfdisplayitem->rotate</function>, <function>swfdisplayitem->rotateto</function>, <function>swfdisplayitem->skewxto</function>, <function>swfdisplayitem->skewx</function>, <function>swfdisplayitem->skewyto</function> <function>swfdisplayitem->skewyto</function>, <function>swfdisplayitem->setdepth</function> <function>swfdisplayitem->remove</function>, <function>swfdisplayitem->setname</function> <function>swfdisplayitem->setratio</function>, <function>swfdisplayitem->addcolor</function> et <function>swfdisplayitem->multcolor</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.moveto"> <refnamediv> <refname>SWFDisplayItem->moveTo</refname> <refpurpose>Moves object in global coordinates.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->moveto</function></funcdef> <paramdef>int <parameter>x</parameter></paramdef> <paramdef>int <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->moveto</function> moves the current object to (<parameter>x</parameter>,<parameter>y</parameter>) in global coordinates. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->move</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.move"> <refnamediv> <refname>SWFDisplayItem->move</refname> <refpurpose>Moves object in relative coordinates.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->move</function></funcdef> <paramdef>int <parameter>dx</parameter></paramdef> <paramdef>int <parameter>dy</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->move</function> moves the current object by (<parameter>dx</parameter>,<parameter>dy</parameter>) from its current position. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->moveto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.scaleto"> <refnamediv> <refname>SWFDisplayItem->scaleTo</refname> <refpurpose>Scales the object in global coordinates.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->scaleto</function></funcdef> <paramdef>int <parameter>x</parameter></paramdef> <paramdef>int <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->scaleto</function> scales the current object to (<parameter>x</parameter>,<parameter>y</parameter>) in global coordinates. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->scale</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.scale"> <refnamediv> <refname>SWFDisplayItem->scale</refname> <refpurpose>Scales the object in relative coordinates.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->scale</function></funcdef> <paramdef>int <parameter>dx</parameter></paramdef> <paramdef>int <parameter>dy</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->scale</function> scales the current object by (<parameter>dx</parameter>,<parameter>dy</parameter>) from its current size. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->scaleto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.rotateto"> <refnamediv> <refname>SWFDisplayItem->rotateTo</refname> <refpurpose>Rotates the object in global coordinates.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->rotateto</function></funcdef> <paramdef>double <parameter>degrees</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->rotateto</function> set the current object rotation to <parameter>degrees</parameter> degrees in global coordinates. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <para> This example bring three rotating string from the background to the foreground. Pretty nice. <example> <title><function>swfdisplayitem->rotateto</function> example</title> <programlisting role="php"> &lt;?php $thetext = "ming!"; $f = new SWFFont("Bauhaus 93.fdb"); $m = new SWFMovie(); $m-&gt;setRate(24.0); $m-&gt;setDimension(2400, 1600); $m-&gt;setBackground(0xff, 0xff, 0xff); // functions with huge numbers of arbitrary // arguments are always a good idea! Really! function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string) { global $f, $m; $t = new SWFText(); $t-&gt;setFont($f); $t-&gt;setColor($r, $g, $b, $a); $t-&gt;setHeight(960); $t-&gt;moveTo(-($f-&gt;getWidth($string))/2, $f-&gt;getAscent()/2); $t-&gt;addString($string); // we can add properties just like a normal php var, // as long as the names aren't already used. // e.g., we can't set $i-&gt;scale, because that's a function $i = $m-&gt;add($t); $i-&gt;x = $x; $i-&gt;y = $y; $i-&gt;rot = $rot; $i-&gt;s = $scale; $i-&gt;rotateTo($rot); $i-&gt;scale($scale, $scale); // but the changes are local to the function, so we have to // return the changed object. kinda weird.. return $i; } function step($i) { $oldrot = $i-&gt;rot; $i-&gt;rot = 19*$i-&gt;rot/20; $i-&gt;x = (19*$i-&gt;x + 1200)/20; $i-&gt;y = (19*$i-&gt;y + 800)/20; $i-&gt;s = (19*$i-&gt;s + 1.0)/20; $i-&gt;rotateTo($i-&gt;rot); $i-&gt;scaleTo($i-&gt;s, $i-&gt;s); $i-&gt;moveTo($i-&gt;x, $i-&gt;y); return $i; } // see? it sure paid off in legibility: $i1 = text(0xff, 0x33, 0x33, 0xff, 900, 1200, 800, 0.03, $thetext); $i2 = text(0x00, 0x33, 0xff, 0x7f, -560, 1200, 800, 0.04, $thetext); $i3 = text(0xff, 0xff, 0xff, 0x9f, 180, 1200, 800, 0.001, $thetext); for($i=1; $i<=100; ++$i) { $i1 = step($i1); $i2 = step($i2); $i3 = step($i3); $m-&gt;nextFrame(); } header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> <simpara> See also <function>swfdisplayitem->rotate</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.rotate"> <refnamediv> <refname>SWFDisplayItem->Rotate</refname> <refpurpose>Rotates in relative coordinates.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->rotate</function></funcdef> <paramdef>double <parameter>ddegrees</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->rotate</function> rotates the current object by <parameter>ddegrees</parameter> degrees from its current rotation. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->rotateto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.skewxto"> <refnamediv> <refname>SWFDisplayItem->skewXTo</refname> <refpurpose>Sets the X-skew.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->skewxto</function></funcdef> <paramdef>double <parameter>degrees</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->skewxto</function> sets the x-skew to <parameter>degrees</parameter>. For <parameter>degrees</parameter> is 1.0, it means a 45-degree forward slant. More is more forward, less is more backward. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->skewx</function>, <function>swfdisplayitem->skewy</function> and <function>swfdisplayitem->skewyto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.skewx"> <refnamediv> <refname>SWFDisplayItem->skewX</refname> <refpurpose>Sets the X-skew.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->skewx</function></funcdef> <paramdef>double <parameter>ddegrees</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->skewx</function> adds <parameter>ddegrees</parameter> to current x-skew. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->skewx</function>, <function>swfdisplayitem->skewy</function> and <function>swfdisplayitem->skewyto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.skewyto"> <refnamediv> <refname>SWFDisplayItem->skewYTo</refname> <refpurpose>Sets the Y-skew.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->skewyto</function></funcdef> <paramdef>double <parameter>degrees</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->skewyto</function> sets the y-skew to <parameter>degrees</parameter>. For <parameter>degrees</parameter> is 1.0, it means a 45-degree forward slant. More is more upward, less is more downward. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->skewy</function>, <function>swfdisplayitem->skewx</function> and <function>swfdisplayitem->skewxto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.skewy"> <refnamediv> <refname>SWFDisplayItem->skewY</refname> <refpurpose>Sets the Y-skew.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->skewy</function></funcdef> <paramdef>double <parameter>ddegrees</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->skewy</function> adds <parameter>ddegrees</parameter> to current y-skew. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfdisplayitem->skewyto</function>, <function>swfdisplayitem->skewx</function> and <function>swfdisplayitem->skewxto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.setdepth"> <refnamediv> <refname>SWFDisplayItem->setDepth</refname> <refpurpose>Sets z-order</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->setdepth</function></funcdef> <paramdef>double <parameter>depth</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->rotate</function> sets the object's z-order to <parameter>depth</parameter>. Depth defaults to the order in which instances are created (by add'ing a shape/text to a movie)- newer ones are on top of older ones. If two objects are given the same depth, only the later-defined one can be moved. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.remove"> <refnamediv> <refname>SWFDisplayItem->remove</refname> <refpurpose>Removes the object from the movie</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->remove</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->remove</function> removes this object from the movie's display list. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <simpara> See also <function>swfmovie->add</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.setname"> <refnamediv> <refname>SWFDisplayItem->setName</refname> <refpurpose>Sets the object's name</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->setname</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->setname</function> sets the object's name to <parameter>name</parameter>, for targetting with action script. Only useful on sprites. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.setratio"> <refnamediv> <refname>SWFDisplayItem->setRatio</refname> <refpurpose>Sets the object's ratio.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->setratio</function></funcdef> <paramdef>double <parameter>ratio</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->setratio</function> sets the object's ratio to <parameter>ratio</parameter>. Obviously only useful for morphs. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <para> This simple example will morph nicely three concentric circles. <example> <title><function>swfdisplayitem->setname</function> example</title> <programlisting role="php"> &lt;?php $p = new SWFMorph(); $g = new SWFGradient(); $g-&gt;addEntry(0.0, 0, 0, 0); $g-&gt;addEntry(0.16, 0xff, 0xff, 0xff); $g-&gt;addEntry(0.32, 0, 0, 0); $g-&gt;addEntry(0.48, 0xff, 0xff, 0xff); $g-&gt;addEntry(0.64, 0, 0, 0); $g-&gt;addEntry(0.80, 0xff, 0xff, 0xff); $g-&gt;addEntry(1.00, 0, 0, 0); $s = $p-&gt;getShape1(); $f = $s-&gt;addFill($g, SWFFILL_RADIAL_GRADIENT); $f-&gt;scaleTo(0.05); $s-&gt;setLeftFill($f); $s-&gt;movePenTo(-160, -120); $s-&gt;drawLine(320, 0); $s-&gt;drawLine(0, 240); $s-&gt;drawLine(-320, 0); $s-&gt;drawLine(0, -240); $g = new SWFGradient(); $g-&gt;addEntry(0.0, 0, 0, 0); $g-&gt;addEntry(0.16, 0xff, 0, 0); $g-&gt;addEntry(0.32, 0, 0, 0); $g-&gt;addEntry(0.48, 0, 0xff, 0); $g-&gt;addEntry(0.64, 0, 0, 0); $g-&gt;addEntry(0.80, 0, 0, 0xff); $g-&gt;addEntry(1.00, 0, 0, 0); $s = $p-&gt;getShape2(); $f = $s-&gt;addFill($g, SWFFILL_RADIAL_GRADIENT); $f-&gt;scaleTo(0.05); $f-&gt;skewXTo(1.0); $s-&gt;setLeftFill($f); $s-&gt;movePenTo(-160, -120); $s-&gt;drawLine(320, 0); $s-&gt;drawLine(0, 240); $s-&gt;drawLine(-320, 0); $s-&gt;drawLine(0, -240); $m = new SWFMovie(); $m-&gt;setDimension(320, 240); $i = $m-&gt;add($p); $i-&gt;moveTo(160, 120); for($n=0; $n<=1.001; $n+=0.01) { $i-&gt;setRatio($n); $m-&gt;nextFrame(); } header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfdisplayitem.addcolor"> <refnamediv> <refname>SWFDisplayItem->addColor</refname> <refpurpose>Adds the given color to this item's color transform.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->addcolor</function></funcdef> <paramdef>integer <parameter><optional>red</optional></parameter></paramdef> <paramdef>integer <parameter><optional>green</optional></parameter></paramdef> <paramdef>integer <parameter><optional>blue</optional></parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->addcolor</function> adds the color to this item's color transform. The color is given in its RGB form. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfdisplayitem.multcolor"> <refnamediv> <refname>SWFDisplayItem->multColor</refname> <refpurpose>Multiplies the item's color transform.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfdisplayitem->multcolor</function></funcdef> <paramdef>integer <parameter><optional>red</optional></parameter></paramdef> <paramdef>integer <parameter><optional>green</optional></parameter></paramdef> <paramdef>integer <parameter><optional>blue</optional></parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfdisplayitem->multcolor</function> multiplies the item's color transform by the given values. </para> <simpara> The object may be a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function> or a <function>swfsprite</function> object. It must have been added using the <function>swfmovie->add</function>. </simpara> <para> This simple example will modify your picture's atmospher to Halloween (use a landscape or bright picture). <example> <title><function>swfdisplayitem->multcolor</function> example</title> <programlisting role="php"> &lt;?php $b = new SWFBitmap("backyard.jpg"); // note use your own picture :-) $s = new SWFShape(); $s-&gt;setRightFill($s-&gt;addFill($b)); $s-&gt;drawLine($b-&gt;getWidth(), 0); $s-&gt;drawLine(0, $b-&gt;getHeight()); $s-&gt;drawLine(-$b-&gt;getWidth(), 0); $s-&gt;drawLine(0, -$b-&gt;getHeight()); $m = new SWFMovie(); $m-&gt;setDimension($b-&gt;getWidth(), $b-&gt;getHeight()); $i = $m-&gt;add($s); for($n=0; $n<=20; ++$n) { $i-&gt;multColor(1.0-$n/10, 1.0, 1.0); $i-&gt;addColor(0xff*$n/20, 0, 0); $m-&gt;nextFrame(); } header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <!-- SWFShape --> <refentry id="function.swfshape"> <refnamediv> <refname>SWFShape</refname> <refpurpose>Creates a new shape object.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfshape</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfshape</function> creates a new shape object. </para> <simpara> SWFShape has the following methods : <function>swfshape->setline</function>, <function>swfshape->addfill</function>, <function>swfshape->setleftfile</function>, <function>swfshape->setrightfile</function>, <function>swfshape->movepento</function>, <function>swfshape->movepen</function>, <function>swfshape->drawlineto</function>, <function>swfshape->drawline</function>, <function>swfshape->drawcurveto</function> et <function>swfshape->drawcurve</function>. </simpara> <para> This simple example will draw a big red elliptic quadrant. <example> <title><function>swfshape</function> example</title> <programlisting role="php"> &lt;?php $s = new SWFShape(); $s-&gt;setLine(40, 0x7f, 0, 0); $s-&gt;setRightFill($s-&gt;addFill(0xff, 0, 0)); $s-&gt;movePenTo(200, 200); $s-&gt;drawLineTo(6200, 200); $s-&gt;drawLineTo(6200, 4600); $s-&gt;drawCurveTo(200, 4600, 200, 200); $m = new SWFMovie(); $m-&gt;setDimension(6400, 4800); $m-&gt;setRate(12.0); $m-&gt;add($s); $m-&gt;nextFrame(); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfshape.setline"> <refnamediv> <refname>SWFShape->setLine</refname> <refpurpose>Sets the shape's line style.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->setline</function></funcdef> <paramdef>int <parameter>width</parameter></paramdef> <paramdef>integer <parameter><optional>red</optional></parameter></paramdef> <paramdef>integer <parameter><optional>green</optional></parameter></paramdef> <paramdef>integer <parameter><optional>blue</optional></parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfshape->setline</function> sets the shape's line style. <parameter>width</parameter> is the line's width. If <parameter>width</parameter> is 0, the line's style is removed (then, all other arguments are ignored). If <parameter>width</parameter> > 0, then line's color is set to <parameter>red</parameter>, <parameter>green</parameter>, <parameter>blue</parameter>. Last parameter <parameter>a</parameter> is optional. </para> <simpara> <function>swfshape->setline</function> accepts 1, 4 or 5 arguments (not 3 or 2). </simpara> <para> You must declare all line styles before you use them (see example). </para> <para> This simple example will draw a big "!#%*@", in funny colors and gracious style. <example> <title><function>swfshape->setline</function> example</title> <programlisting role="php"> &lt;?php $s = new SWFShape(); $f1 = $s-&gt;addFill(0xff, 0, 0); $f2 = $s-&gt;addFill(0xff, 0x7f, 0); $f3 = $s-&gt;addFill(0xff, 0xff, 0); $f4 = $s-&gt;addFill(0, 0xff, 0); $f5 = $s-&gt;addFill(0, 0, 0xff); // bug: have to declare all line styles before you use them $s-&gt;setLine(40, 0x7f, 0, 0); $s-&gt;setLine(40, 0x7f, 0x3f, 0); $s-&gt;setLine(40, 0x7f, 0x7f, 0); $s-&gt;setLine(40, 0, 0x7f, 0); $s-&gt;setLine(40, 0, 0, 0x7f); $f = new SWFFont('Techno.fdb'); $s-&gt;setRightFill($f1); $s-&gt;setLine(40, 0x7f, 0, 0); $s-&gt;drawGlyph($f, '!'); $s-&gt;movePen($f-&gt;getWidth('!'), 0); $s-&gt;setRightFill($f2); $s-&gt;setLine(40, 0x7f, 0x3f, 0); $s-&gt;drawGlyph($f, '#'); $s-&gt;movePen($f-&gt;getWidth('#'), 0); $s-&gt;setRightFill($f3); $s-&gt;setLine(40, 0x7f, 0x7f, 0); $s-&gt;drawGlyph($f, '%'); $s-&gt;movePen($f-&gt;getWidth('%'), 0); $s-&gt;setRightFill($f4); $s-&gt;setLine(40, 0, 0x7f, 0); $s-&gt;drawGlyph($f, '*'); $s-&gt;movePen($f-&gt;getWidth('*'), 0); $s-&gt;setRightFill($f5); $s-&gt;setLine(40, 0, 0, 0x7f); $s-&gt;drawGlyph($f, '@'); $m = new SWFMovie(); $m-&gt;setDimension(3000,2000); $m-&gt;setRate(12.0); $i = $m-&gt;add($s); $i-&gt;moveTo(1500-$f-&gt;getWidth("!#%*@")/2, 1000+$f-&gt;getAscent()/2); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfshape.addfill"> <refnamediv> <refname>SWFShape->addFill</refname> <refpurpose>Adds a solid fill to the shape.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->addfill</function></funcdef> <paramdef>integer <parameter>red</parameter></paramdef> <paramdef>integer <parameter>green</parameter></paramdef> <paramdef>integer <parameter>blue</parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->addfill</function></funcdef> <paramdef>SWFbitmap <parameter>bitmap</parameter></paramdef> <paramdef>integer <parameter><optional>flags</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->addfill</function></funcdef> <paramdef>SWFGradient <parameter>gradient</parameter></paramdef> <paramdef>integer <parameter><optional>flags</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfshape->addfill</function> adds a solid fill to the shape's list of fill styles. <function>swfshape->addfill</function> accepts three different types of arguments. </para> <para> <parameter>red</parameter>, <parameter>green</parameter>, <parameter>blue</parameter> is a color (RGB mode). Last parameter <parameter>a</parameter> is optional. </para> <para> The <parameter>bitmap</parameter> argument is an <function>swfbitmap</function> object. The <parameter>flags</parameter> argument can be one of the following values : SWFFILL_CLIPPED_BITMAP or SWFFILL_TILED_BITMAP. Default is SWFFILL_TILED_BITMAP. I think. </para> <para> The <parameter>gradient</parameter> argument is an <function>swfgradient</function> object. The flags argument can be one of the following values : SWFFILL_RADIAL_GRADIENT or SWFFILL_LINEAR_GRADIENT. Default is SWFFILL_LINEAR_GRADIENT. I'm sure about this one. Really. </para> <para> <function>swfshape->addfill</function> returns an <function>swffill</function> object for use with the <function>swfshape->setfill</function> functions described below. </para> <simpara> See also <function>swfshape->setfill</function>. </simpara> <para> This simple example will draw a frame on a bitmap. Ah, here's another buglet in the flash player- it doesn't seem to care about the second shape's bitmap's transformation in a morph. According to spec, the bitmap should stretch along with the shape in this example.. <example> <title><function>swfshape->addfill</function> example</title> <programlisting role="php"> &lt;?php $p = new SWFMorph(); $b = new SWFBitmap("alphafill.jpg"); // use your own bitmap $width = $b-&gt;getWidth(); $height = $b-&gt;getHeight(); $s = $p-&gt;getShape1(); $f = $s-&gt;addFill($b, SWFFILL_TILED_BITMAP); $f-&gt;moveTo(-$width/2, -$height/4); $f-&gt;scaleTo(1.0, 0.5); $s-&gt;setLeftFill($f); $s-&gt;movePenTo(-$width/2, -$height/4); $s-&gt;drawLine($width, 0); $s-&gt;drawLine(0, $height/2); $s-&gt;drawLine(-$width, 0); $s-&gt;drawLine(0, -$height/2); $s = $p-&gt;getShape2(); $f = $s-&gt;addFill($b, SWFFILL_TILED_BITMAP); // these two have no effect! $f-&gt;moveTo(-$width/4, -$height/2); $f-&gt;scaleTo(0.5, 1.0); $s-&gt;setLeftFill($f); $s-&gt;movePenTo(-$width/4, -$height/2); $s-&gt;drawLine($width/2, 0); $s-&gt;drawLine(0, $height); $s-&gt;drawLine(-$width/2, 0); $s-&gt;drawLine(0, -$height); $m = new SWFMovie(); $m-&gt;setDimension($width, $height); $i = $m-&gt;add($p); $i-&gt;moveTo($width/2, $height/2); for($n=0; $n<1.001; $n+=0.03) { $i-&gt;setRatio($n); $m-&gt;nextFrame(); } header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfshape.setleftfill"> <refnamediv> <refname>SWFShape->setLeftFill</refname> <refpurpose>Sets left rasterizing color.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->setleftfill</function></funcdef> <paramdef>swfgradient <parameter>fill</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->setleftfill</function></funcdef> <paramdef>integer <parameter>red</parameter></paramdef> <paramdef>integer <parameter>green</parameter></paramdef> <paramdef>integer <parameter>blue</parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> What this nonsense is about is, every edge segment borders at most two fills. When rasterizing the object, it's pretty handy to know what those fills are ahead of time, so the swf format requires these to be specified. </para> <para> <function>swfshape->setleftfill</function> sets the fill on the left side of the edge- that is, on the interior if you're defining the outline of the shape in a counter-clockwise fashion. The fill object is an SWFFill object returned from one of the addFill functions above. </para> <para> This seems to be reversed when you're defining a shape in a morph, though. If your browser crashes, just try setting the fill on the other side. </para> <simpara> Shortcut for <literal>swfshape->setleftfill($s->addfill($r, $g, $b [, $a]));</literal>. </simpara> <simpara> See also <function>swfshape->setrightfill</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfshape.setrightfill"> <refnamediv> <refname>SWFShape->setRightFill</refname> <refpurpose>Sets right rasterizing color.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->setrightfill</function></funcdef> <paramdef>swfgradient <parameter>fill</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->setrightfill</function></funcdef> <paramdef>integer <parameter>red</parameter></paramdef> <paramdef>integer <parameter>green</parameter></paramdef> <paramdef>integer <parameter>blue</parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> See also <function>swfshape->setleftfill</function>. </simpara> <simpara> Shortcut for <literal>swfshape->setrightfill($s->addfill($r, $g, $b [, $a]));</literal>. </simpara> </refsect1> </refentry> <refentry id="function.swfshape.movepento"> <refnamediv> <refname>SWFShape->movePenTo</refname> <refpurpose>Moves the shape's pen.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->movepento</function></funcdef> <paramdef>integer <parameter>x</parameter></paramdef> <paramdef>integer <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>swfshape->setrightfill</function> move the shape's pen to (<parameter>x</parameter>,<parameter>y</parameter>) in the shape's coordinate space. </simpara> <simpara> See also <function>swfshape->movepen</function>, <function>swfshape->drawcurveto</function>, <function>swfshape->drawlineto</function> et <function>swfshape->drawline</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfshape.movepen"> <refnamediv> <refname>SWFShape->movePen</refname> <refpurpose>Moves the shape's pen (relative).</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->movepen</function></funcdef> <paramdef>integer <parameter>dx</parameter></paramdef> <paramdef>integer <parameter>dy</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>swfshape->setrightfill</function> move the shape's pen from coordinates (current x,current y) to (current x + <parameter>dx</parameter>, current y + <parameter>dy</parameter>) in the shape's coordinate space. </simpara> <simpara> See also <function>swfshape->movepento</function>, <function>swfshape->drawcurveto</function>, <function>swfshape->drawlineto</function> et <function>swfshape->drawline</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfshape.drawlineto"> <refnamediv> <refname>SWFShape->drawLineTo</refname> <refpurpose>Draws a line.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->drawlineto</function></funcdef> <paramdef>integer <parameter>x</parameter></paramdef> <paramdef>integer <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>swfshape->setrightfill</function> draws a line (using the current line style, set by <function>swfshape->setline</function>) from the current pen position to point (<parameter>x</parameter>,<parameter>y</parameter>) in the shape's coordinate space. </simpara> <simpara> See also <function>swfshape->movepento</function>, <function>swfshape->drawcurveto</function>, <function>swfshape->movepen</function> et <function>swfshape->drawline</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfshape.drawline"> <refnamediv> <refname>SWFShape->drawLine</refname> <refpurpose>Draws a line (relative).</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->drawline</function></funcdef> <paramdef>integer <parameter>dx</parameter></paramdef> <paramdef>integer <parameter>dy</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>swfshape->setrightfill</function> draws a line (using the current line style set by <function>swfshape->setline</function>) from the current pen position to displacement (<parameter>dx</parameter>,<parameter>dy</parameter>). </simpara> <simpara> See also <function>swfshape->movepento</function>, <function>swfshape->drawcurveto</function>, <function>swfshape->movepen</function> et <function>swfshape->drawlineto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfshape.drawcurveto"> <refnamediv> <refname>SWFShape->drawCurveTo</refname> <refpurpose>Draws a curve.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->drawcurveto</function></funcdef> <paramdef>integer <parameter>controlx</parameter></paramdef> <paramdef>integer <parameter>controly</parameter></paramdef> <paramdef>integer <parameter>anchorx</parameter></paramdef> <paramdef>integer <parameter>anchory</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>swfshape->drawcurveto</function> draws a quadratic curve (using the current line style, set by <function>swfshape->setline</function>) from the current pen position to (<parameter>anchorx</parameter>,<parameter>anchory</parameter>) using (<parameter>controlx</parameter>,<parameter>controly</parameter>) as a control point. That is, head towards the control point, then smoothly turn to the anchor point. </simpara> <simpara> See also <function>swfshape->drawlineto</function>, <function>swfshape->drawline</function>, <function>swfshape->movepento</function> et <function>swfshape->movepen</function>. </simpara> </refsect1> </refentry> <refentry id="function.swfshape.drawcurve"> <refnamediv> <refname>SWFShape->drawCurve</refname> <refpurpose>Draws a curve (relative).</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfshape->drawcurve</function></funcdef> <paramdef>integer <parameter>controldx</parameter></paramdef> <paramdef>integer <parameter>controldy</parameter></paramdef> <paramdef>integer <parameter>anchordx</parameter></paramdef> <paramdef>integer <parameter>anchordy</parameter></paramdef> </funcprototype> </funcsynopsis> <simpara> <function>swfshape->drawcurve</function> draws a quadratic curve (using the current line style,set by <function>swfshape->setline</function>) from the current pen position to the relative position (<parameter>anchorx</parameter>,<parameter>anchory</parameter>) using relative control point (<parameter>controlx</parameter>,<parameter>controly</parameter>). That is, head towards the control point, then smoothly turn to the anchor point. </simpara> <simpara> See also <function>swfshape->drawlineto</function>, <function>swfshape->drawline</function>, <function>swfshape->movepento</function> et <function>swfshape->movepen</function>. </simpara> </refsect1> </refentry> <!-- SWFGradient --> <refentry id="function.swfgradient"> <refnamediv> <refname>SWFGradient</refname> <refpurpose>Creates a gradient object</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfgradient</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfgradient</function> creates a new SWFGradient object. </para> <simpara> After you've added the entries to your gradient, you can use the gradient in a shape fill with the <function>swfshape->addfill</function> method. </simpara> <simpara> SWFGradient has the following methods : <function>swfgradient->addentry</function>. </simpara> <para> This simple example will draw a big black-to-white gradient as background, and a redish disc in its center. <example> <title><function>swfgradient</function> example</title> <programlisting role="php"> &lt;?php $m = new SWFMovie(); $m-&gt;setDimension(320, 240); $s = new SWFShape(); // first gradient- black to white $g = new SWFGradient(); $g-&gt;addEntry(0.0, 0, 0, 0); $g-&gt;addEntry(1.0, 0xff, 0xff, 0xff); $f = $s-&gt;addFill($g, SWFFILL_LINEAR_GRADIENT); $f-&gt;scaleTo(0.01); $f-&gt;moveTo(160, 120); $s-&gt;setRightFill($f); $s-&gt;drawLine(320, 0); $s-&gt;drawLine(0, 240); $s-&gt;drawLine(-320, 0); $s-&gt;drawLine(0, -240); $m-&gt;add($s); $s = new SWFShape(); // second gradient- radial gradient from red to transparent $g = new SWFGradient(); $g-&gt;addEntry(0.0, 0xff, 0, 0, 0xff); $g-&gt;addEntry(1.0, 0xff, 0, 0, 0); $f = $s-&gt;addFill($g, SWFFILL_RADIAL_GRADIENT); $f-&gt;scaleTo(0.005); $f-&gt;moveTo(160, 120); $s-&gt;setRightFill($f); $s-&gt;drawLine(320, 0); $s-&gt;drawLine(0, 240); $s-&gt;drawLine(-320, 0); $s-&gt;drawLine(0, -240); $m-&gt;add($s); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfgradient.addentry"> <refnamediv> <refname>SWFGradient->addEntry</refname> <refpurpose>Adds an entry to the gradient list.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfgradient->addentry</function></funcdef> <paramdef>double <parameter>ratio</parameter></paramdef> <paramdef>integer <parameter>red</parameter></paramdef> <paramdef>integer <parameter>green</parameter></paramdef> <paramdef>integer <parameter>blue</parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfgradient->addentry</function> adds an entry to the gradient list. <parameter>ratio</parameter> is a number between 0 and 1 indicating where in the gradient this color appears. Thou shalt add entries in order of increasing ratio. </para> <para> <parameter>red</parameter>, <parameter>green</parameter>, <parameter>blue</parameter> is a color (RGB mode). Last parameter <parameter>a</parameter> is optional. </para> </refsect1> </refentry> <!-- SWFBitmap --> <refentry id="function.swfbitmap"> <refnamediv> <refname>SWFBitmap</refname> <refpurpose>Loads Bitmap object</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfbitmap</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> <paramdef>integer <parameter><optional>alphafilename</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbitmap</function> creates a new SWFBitmap object from the Jpeg or DBL file named <parameter>filename</parameter>. <parameter>alphafilename</parameter> indicates a MSK file to be used as an alpha mask for a Jpeg image. </para> <note> <para> We can only deal with baseline (frame 0) jpegs, no baseline optimized or progressive scan jpegs! </para> </note> <simpara> SWFBitmap has the following methods : <function>swfbitmap->getwidth</function> and <function>swfbitmap->getheight</function>. </simpara> <para> You can't import png images directly, though- have to use the png2dbl utility to make a dbl ("define bits lossless") file from the png. The reason for this is that I don't want a dependency on the png library in ming- autoconf should solve this, but that's not set up yet. <example> <title>Import PNG files</title> <programlisting role="php"> &lt;?php $s = new SWFShape(); $f = $s-&gt;addFill(new SWFBitmap("png.dbl")); $s-&gt;setRightFill($f); $s-&gt;drawLine(32, 0); $s-&gt;drawLine(0, 32); $s-&gt;drawLine(-32, 0); $s-&gt;drawLine(0, -32); $m = new SWFMovie(); $m-&gt;setDimension(32, 32); $m-&gt;add($s); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> <para> And you can put an alpha mask on a jpeg fill. <example> <title><function>swfbitmap</function> example</title> <programlisting role="php"> &lt;?php $s = new SWFShape(); // .msk file generated with "gif2mask" utility $f = $s-&gt;addFill(new SWFBitmap("alphafill.jpg", "alphafill.msk")); $s-&gt;setRightFill($f); $s-&gt;drawLine(640, 0); $s-&gt;drawLine(0, 480); $s-&gt;drawLine(-640, 0); $s-&gt;drawLine(0, -480); $c = new SWFShape(); $c-&gt;setRightFill($c-&gt;addFill(0x99, 0x99, 0x99)); $c-&gt;drawLine(40, 0); $c-&gt;drawLine(0, 40); $c-&gt;drawLine(-40, 0); $c-&gt;drawLine(0, -40); $m = new SWFMovie(); $m-&gt;setDimension(640, 480); $m-&gt;setBackground(0xcc, 0xcc, 0xcc); // draw checkerboard background for($y=0; $y<480; $y+=40) { for($x=0; $x<640; $x+=80) { $i = $m-&gt;add($c); $i-&gt;moveTo($x, $y); } $y+=40; for($x=40; $x<640; $x+=80) { $i = $m-&gt;add($c); $i-&gt;moveTo($x, $y); } } $m-&gt;add($s); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfbitmap.getwidth"> <refnamediv> <refname>SWFBitmap->getWidth</refname> <refpurpose>Returns the bitmap's width.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>int <function>swfbitmap->getwidth</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbitmap->getwidth</function> returns the bitmap's width in pixels. </para> <para> See also <function>swfbitmap->getheight</function>. </para> </refsect1> </refentry> <refentry id="function.swfbitmap.getheight"> <refnamediv> <refname>SWFBitmap->getHeight</refname> <refpurpose>Returns the bitmap's height.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>int <function>swfbitmap->getheight</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbitmap->getheight</function> returns the bitmap's height in pixels. </para> <para> See also <function>swfbitmap->getwidth</function>. </para> </refsect1> </refentry> <!-- SWFFill --> <refentry id="function.swffill"> <refnamediv> <refname>SWFFill</refname> <refpurpose>Loads SWFFill object</refpurpose> </refnamediv> <refsect1> <title>説明</title> <para> The <function>swffill</function> object allows you to transform (scale, skew, rotate) bitmap and gradient fills. <function>swffill</function> objects are created by the <function>swfshape->addfill</function> methods. </para> <simpara> SWFFill has the following methods : <function>swffill->moveto</function> and <function>swffill->scaleto</function>, <function>swffill->rotateto</function>, <function>swffill->skewxto</function> and <function>swffill->skewyto</function>. </simpara> </refsect1> </refentry> <refentry id="function.swffill.moveto"> <refnamediv> <refname>SWFFill->moveTo</refname> <refpurpose>Moves fill origin</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swffill->moveto</function></funcdef> <paramdef>integer <parameter>x</parameter></paramdef> <paramdef>integer <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swffill->moveto</function> moves fill's origin to (<parameter>x</parameter>,<parameter>y</parameter>) in global coordinates. </para> </refsect1> </refentry> <refentry id="function.swffill.scaleto"> <refnamediv> <refname>SWFFill->scaleTo</refname> <refpurpose>Sets fill's scale</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swffill->scaleto</function></funcdef> <paramdef>integer <parameter>x</parameter></paramdef> <paramdef>integer <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swffill->scaleto</function> sets fill's scale to <parameter>x</parameter> in the x-direction, <parameter>y</parameter> in the y-direction. </para> </refsect1> </refentry> <refentry id="function.swffill.rotateto"> <refnamediv> <refname>SWFFill->rotateTo</refname> <refpurpose>Sets fill's rotation</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swffill->rotateto</function></funcdef> <paramdef>double <parameter>degrees</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swffill->rotateto</function> sets fill's rotation to <parameter>degrees</parameter> degrees. </para> </refsect1> </refentry> <refentry id="function.swffill.skewxto"> <refnamediv> <refname>SWFFill->skewXTo</refname> <refpurpose>Sets fill x-skew</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swffill->skewxto</function></funcdef> <paramdef>double <parameter>x</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swffill->skewxto</function> sets fill x-skew to <parameter>x</parameter>. For <parameter>x</parameter> is 1.0, it is a is a 45-degree forward slant. More is more forward, less is more backward. </para> </refsect1> </refentry> <refentry id="function.swffill.skewyto"> <refnamediv> <refname>SWFFill->skewYTo</refname> <refpurpose>Sets fill y-skew</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swffill->skewyto</function></funcdef> <paramdef>double <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swffill->skewyto</function> sets fill y-skew to <parameter>y</parameter>. For <parameter>y</parameter> is 1.0, it is a is a 45-degree upward slant. More is more upward, less is more downward. </para> </refsect1> </refentry> <!-- SWFMorph --> <refentry id="function.swfmorph"> <refnamediv> <refname>SWFMorph</refname> <refpurpose>Creates a new SWFMorph object.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfmorph</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmorph</function> creates a new SWFMorph object. </para> <para> Also called a "shape tween". This thing lets you make those tacky twisting things that make your computer choke. Oh, joy! </para> <para> The methods here are sort of weird. It would make more sense to just have newSWFMorph(shape1, shape2);, but as things are now, shape2 needs to know that it's the second part of a morph. (This, because it starts writing its output as soon as it gets drawing commands- if it kept its own description of its shapes and wrote on completion this and some other things would be much easier.) </para> <simpara> SWFMorph has the following methods : <function>swfmorph->getshape1</function> and <function>swfmorph->getshape1</function>. </simpara> <para> This simple example will morph a big red square into a smaller blue black-bordered square. <example> <title><function>swfmorph</function> example</title> <programlisting role="php"> &lt;?php $p = new SWFMorph(); $s = $p-&gt;getShape1(); $s-&gt;setLine(0,0,0,0); /* Note that this is backwards from normal shapes (left instead of right). I have no idea why, but this seems to work.. */ $s-&gt;setLeftFill($s-&gt;addFill(0xff, 0, 0)); $s-&gt;movePenTo(-1000,-1000); $s-&gt;drawLine(2000,0); $s-&gt;drawLine(0,2000); $s-&gt;drawLine(-2000,0); $s-&gt;drawLine(0,-2000); $s = $p-&gt;getShape2(); $s-&gt;setLine(60,0,0,0); $s-&gt;setLeftFill($s-&gt;addFill(0, 0, 0xff)); $s-&gt;movePenTo(0,-1000); $s-&gt;drawLine(1000,1000); $s-&gt;drawLine(-1000,1000); $s-&gt;drawLine(-1000,-1000); $s-&gt;drawLine(1000,-1000); $m = new SWFMovie(); $m-&gt;setDimension(3000,2000); $m-&gt;setBackground(0xff, 0xff, 0xff); $i = $m-&gt;add($p); $i-&gt;moveTo(1500,1000); for($r=0.0; $r<=1.0; $r+=0.1) { $i-&gt;setRatio($r); $m-&gt;nextFrame(); } header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfmorph.getshape1"> <refnamediv> <refname>SWFMorph->getshape1</refname> <refpurpose>Gets a handle to the starting shape</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>swfmorph->getshape1</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmorph->getshape1</function> gets a handle to the morph's starting shape. <function>swfmorph->getshape1</function> returns an <function>swfshape</function> object. </para> </refsect1> </refentry> <refentry id="function.swfmorph.getshape2"> <refnamediv> <refname>SWFMorph->getshape2</refname> <refpurpose>Gets a handle to the ending shape</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>mixed <function>swfmorph->getshape2</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfmorph->getshape2</function> gets a handle to the morph's ending shape. <function>swfmorph->getshape2</function> returns an <function>swfshape</function> object. </para> </refsect1> </refentry> <!-- SWFText --> <refentry id="function.swftext"> <refnamediv> <refname>SWFMorph</refname> <refpurpose>Creates a new SWFText object.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swftext</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swftext</function> creates a new SWFText object, fresh for manipulating. </para> <simpara> SWFText has the following methods : <function>swftext->setfont</function>, <function>swftext->setheight</function>, <function>swftext->setspacing</function>, <function>swftext->setcolor</function>, <function>swftext->moveto</function>, <function>swftext->addstring</function> and <function>swftext->getwidth</function>. </simpara> <para> This simple example will draw a big yellow "PHP generates Flash with Ming" text, on white background. <example> <title><function>swftext</function> example</title> <programlisting role="php"> &lt;?php $f = new SWFFont("Techno.fdb"); $t = new SWFText(); $t-&gt;setFont($f); $t-&gt;moveTo(200, 2400); $t-&gt;setColor(0xff, 0xff, 0); $t-&gt;setHeight(1200); $t-&gt;addString("PHP generates Flash with Ming!!"); $m = new SWFMovie(); $m-&gt;setDimension(5400, 3600); $m-&gt;add($t); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swftext.setfont"> <refnamediv> <refname>SWFText->setFont</refname> <refpurpose>Sets the current font</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftext->setfont</function></funcdef> <paramdef>string <parameter>font</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftext->setfont</function> sets the current font to <parameter>font</parameter>. </para> </refsect1> </refentry> <refentry id="function.swftext.setheight"> <refnamediv> <refname>SWFText->setHeight</refname> <refpurpose>Sets the current font height</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftext->setheight</function></funcdef> <paramdef>integer <parameter>height</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftext->setheight</function> sets the current font height to <parameter>height</parameter>. Default is 240. </para> </refsect1> </refentry> <refentry id="function.swftext.setspacing"> <refnamediv> <refname>SWFText->setSpacing</refname> <refpurpose>Sets the current font spacing</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftext->setspacing</function></funcdef> <paramdef>double <parameter>spacing</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftext->setspacing</function> sets the current font spacing to <parameter>spacing</parameter><parameter>spacing</parameter>. Default is 1.0. 0 is all of the letters written at the same point. This doesn't really work that well because it inflates the advance across the letter, doesn't add the same amount of spacing between the letters. I should try and explain that better, prolly. Or just fix the damn thing to do constant spacing. This was really just a way to figure out how letter advances work, anyway.. So nyah. </para> </refsect1> </refentry> <refentry id="function.swftext.setcolor"> <refnamediv> <refname>SWFText->setColor</refname> <refpurpose>Sets the current font color</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftext->setcolor</function></funcdef> <paramdef>integer <parameter>red</parameter></paramdef> <paramdef>integer <parameter>green</parameter></paramdef> <paramdef>integer <parameter>blue</parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftext->setspacing</function> changes the current text color. Default is black. I think. Color is represented using the RGB system. </para> </refsect1> </refentry> <refentry id="function.swftext.moveto"> <refnamediv> <refname>SWFText->moveTo</refname> <refpurpose>Moves the pen</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftext->moveto</function></funcdef> <paramdef>integer <parameter>x</parameter></paramdef> <paramdef>integer <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftext->moveto</function> moves the pen (or cursor, if that makes more sense) to (<parameter>x</parameter>,<parameter>y</parameter>) in text object's coordinate space. If either is zero, though, value in that dimension stays the same. Annoying, should be fixed. </para> </refsect1> </refentry> <refentry id="function.swftext.addstring"> <refnamediv> <refname>SWFText->addString</refname> <refpurpose>Draws a string</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftext->addstring</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftext->addstring</function> draws the string <parameter>string</parameter> at the current pen (cursor) location. Pen is at the baseline of the text; i.e., ascending text is in the -y direction. </para> </refsect1> </refentry> <refentry id="function.swftext.getwidth"> <refnamediv> <refname>SWFText->getWidth</refname> <refpurpose>Computes string's width</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftext->addstring</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftext->addstring</function> returns the rendered width of the <parameter>string</parameter> string at the text object's current font, scale, and spacing settings. </para> </refsect1> </refentry> <!-- SWFFont --> <refentry id="function.swffont"> <refnamediv> <refname>SWFFont</refname> <refpurpose>Loads a font definition</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swffont</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcprototype> </funcsynopsis> <para> If <parameter>filename</parameter> is the name of an FDB file (i.e., it ends in ".fdb"), load the font definition found in said file. Otherwise, create a browser-defined font reference. </para> <para> FDB ("font definition block") is a very simple wrapper for the SWF DefineFont2 block which contains a full description of a font. One may create FDB files from SWT Generator template files with the included makefdb utility- look in the util directory off the main ming distribution directory. </para> <para> Browser-defined fonts don't contain any information about the font other than its name. It is assumed that the font definition will be provided by the movie player. The fonts _serif, _sans, and _typewriter should always be available. For example: <programlisting role="php"> &lt;?php $f = newSWFFont("_sans"); ?&gt; </programlisting> will give you the standard sans-serif font, probably the same as what you'd get with <literal>&lt;font name="sans-serif"&gt;</literal> in HTML. </para> <para> <function>swffont</function> returns a reference to the font definition, for use in the <function>SWFText->setFont</function> and the <function>SWFTextField->setFont</function> methods. </para> <simpara> SWFFont has the following methods : <function>swffont->getwidth</function>. </simpara> </refsect1> </refentry> <refentry id="function.swffont.getwidth"> <refnamediv> <refname>getwidth</refname> <refpurpose>Returns the string's width</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>int <function>swffont->getwidth</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swffont->getwidth</function> returns the string <parameter>string</parameter>'s width, using font's default scaling. You'll probably want to use the <function>SWFText</function> version of this method which uses the text object's scale. </para> </refsect1> </refentry> <!-- SWFTextField --> <refentry id="function.swftextfield"> <refnamediv> <refname>SWFTextField</refname> <refpurpose>Creates a text field object</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swftextfield</function></funcdef> <paramdef>int <parameter><optional>flags</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield</function> creates a new text field object. Text Fields are less flexible than <function>swftext</function> objects- they can't be rotated, scaled non-proportionally, or skewed, but they can be used as form entries, and they can use browser-defined fonts. </para> <para> The optional flags change the text field's behavior. It has the following possibles values : <itemizedlist> <listitem> <simpara> SWFTEXTFIELD_NOEDIT indicates that the field shouldn't be user-editable </simpara> </listitem> <listitem> <simpara> SWFTEXTFIELD_PASSWORD obscures the data entry </simpara> </listitem> <listitem> <simpara> SWFTEXTFIELD_DRAWBOX draws the outline of the textfield </simpara> </listitem> <listitem> <simpara> SWFTEXTFIELD_MULTILINE allows multiple lines </simpara> </listitem> <listitem> <simpara> SWFTEXTFIELD_WORDWRAP allows text to wrap </simpara> </listitem> <listitem> <simpara> SWFTEXTFIELD_NOSELECT makes the field non-selectable </simpara> </listitem> </itemizedlist> Flags are combined with the bitwise <link linkend="language.operators.bitwise">OR</link> operation. For example, <programlisting role="php"> &lt;?php $t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT); ?&gt; </programlisting> creates a totally useless non-editable password field. </para> <simpara> SWFTextField has the following methods : <function>swftextfield->setfont</function>, <function>swftextfield->setbounds</function>, <function>swftextfield->align</function>, <function>swftextfield->setheight</function>, <function>swftextfield->setleftmargin</function>, <function>swftextfield->setrightmargin</function>, <function>swftextfield->setmargins</function>, <function>swftextfield->setindentation</function>, <function>swftextfield->setlinespacing</function>, <function>swftextfield->setcolor</function>, <function>swftextfield->setname</function> et <function>swftextfield->addstring</function>. </simpara> </refsect1> </refentry> <refentry id="function.swftextfield.setfont"> <refnamediv> <refname>SWFTextField->setFont</refname> <refpurpose>Sets the text field font</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setfont</function></funcdef> <paramdef>string <parameter>font</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setfont</function> sets the text field font to the [browser-defined?] <parameter>font</parameter> font. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setbounds"> <refnamediv> <refname>SWFTextField->setbounds</refname> <refpurpose>Sets the text field width and height</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setbounds</function></funcdef> <paramdef>int <parameter>width</parameter></paramdef> <paramdef>int <parameter>height</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setbounds</function> sets the text field width to <parameter>width</parameter> and height to <parameter>height</parameter>. If you don't set the bounds yourself, Ming makes a poor guess at what the bounds are. </para> </refsect1> </refentry> <refentry id="function.swftextfield.align"> <refnamediv> <refname>SWFTextField->align</refname> <refpurpose>Sets the text field alignment</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->align</function></funcdef> <paramdef>int <parameter>alignement</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->align</function> sets the text field alignment to <parameter>alignement</parameter>. Valid values for <parameter>alignement</parameter> are : SWFTEXTFIELD_ALIGN_LEFT, SWFTEXTFIELD_ALIGN_RIGHT, SWFTEXTFIELD_ALIGN_CENTER and SWFTEXTFIELD_ALIGN_JUSTIFY. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setheight"> <refnamediv> <refname>SWFTextField->setHeight</refname> <refpurpose>Sets the font height of this text field font.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setheight</function></funcdef> <paramdef>int <parameter>height</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setheight</function> sets the font height of this text field font to the given height <parameter>height</parameter>. Default is 240. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setleftmargin"> <refnamediv> <refname>SWFTextField->setLeftMargin</refname> <refpurpose>Sets the left margin width of the text field.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setleftmargin</function></funcdef> <paramdef>int <parameter>width</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setleftmargin</function> sets the left margin width of the text field to <parameter>width</parameter>. Default is 0. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setrightmargin"> <refnamediv> <refname>SWFTextField->setrightMargin</refname> <refpurpose>Sets the right margin width of the text field.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setrightmargin</function></funcdef> <paramdef>int <parameter>width</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setrightmargin</function> sets the right margin width of the text field to <parameter>width</parameter>. Default is 0. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setmargins"> <refnamediv> <refname>SWFTextField->setMargins</refname> <refpurpose>Sets the margins width of the text field.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setmargins</function></funcdef> <paramdef>int <parameter>left</parameter></paramdef> <paramdef>int <parameter>right</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setmargins</function> set both margins at once, for the man on the go. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setindentation"> <refnamediv> <refname>SWFTextField->setindentation</refname> <refpurpose>Sets the indentation of the first line.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setindentation</function></funcdef> <paramdef>int <parameter>width</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setindentation</function> sets the indentation of the first line in the text field, to <parameter>width</parameter>. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setlinespacing"> <refnamediv> <refname>SWFTextField->setLineSpacing</refname> <refpurpose>Sets the line spacing of the text field.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setlinespacing</function></funcdef> <paramdef>int <parameter>height</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setlinespacing</function> sets the line spacing of the text field to the height of <parameter>height</parameter>. Default is 40. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setcolor"> <refnamediv> <refname>SWFTextField->setcolor</refname> <refpurpose>Sets the color of the text field. </refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setcolor</function></funcdef> <paramdef>integer <parameter>red</parameter></paramdef> <paramdef>integer <parameter>green</parameter></paramdef> <paramdef>integer <parameter>blue</parameter></paramdef> <paramdef>integer <parameter><optional>a</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setcolor</function> sets the color of the text field. Default is fully opaque black. Color is represented using RGB system. </para> </refsect1> </refentry> <refentry id="function.swftextfield.setname"> <refnamediv> <refname>SWFTextField->setname</refname> <refpurpose>Sets the variable name</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->setname</function></funcdef> <paramdef>string <parameter>name</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setname</function> sets the variable name of this text field to <parameter>name</parameter>, for form posting and action scripting purposes. </para> </refsect1> </refentry> <refentry id="function.swftextfield.addstring"> <refnamediv> <refname>SWFTextField->addstring</refname> <refpurpose>Concatenates the given string to the text field</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swftextfield->addstring</function></funcdef> <paramdef>string <parameter>string</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swftextfield->setname</function> concatenates the string <parameter>string</parameter> to the text field. </para> </refsect1> </refentry> <!-- SWFSprite --> <refentry id="function.swfsprite"> <refnamediv> <refname>SWFSprite</refname> <refpurpose>Creates a movie clip (a sprite)</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfsprite</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfsprite</function> are also known as a "movie clip", this allows one to create objects which are animated in their own timelines. Hence, the sprite has most of the same methods as the movie. </para> <simpara> <function>swfsprite</function> has the following methods : <function>swfsprite->add</function>, <function>swfsprite->remove</function>, <function>swfsprite->nextframe</function> et <function>swfsprite->setframes</function>. </simpara> <para> This simple example will spin gracefully a big red square. <example> <title><function>swfsprite</function> example</title> <programlisting role="php"> &lt;?php $s = new SWFShape(); $s-&gt;setRightFill($s-&gt;addFill(0xff, 0, 0)); $s-&gt;movePenTo(-500,-500); $s-&gt;drawLineTo(500,-500); $s-&gt;drawLineTo(500,500); $s-&gt;drawLineTo(-500,500); $s-&gt;drawLineTo(-500,-500); $p = new SWFSprite(); $i = $p-&gt;add($s); $p-&gt;nextFrame(); $i-&gt;rotate(15); $p-&gt;nextFrame(); $i-&gt;rotate(15); $p-&gt;nextFrame(); $i-&gt;rotate(15); $p-&gt;nextFrame(); $i-&gt;rotate(15); $p-&gt;nextFrame(); $i-&gt;rotate(15); $p-&gt;nextFrame(); $m = new SWFMovie(); $i = $m-&gt;add($p); $i-&gt;moveTo(1500,1000); $i-&gt;setName("blah"); $m-&gt;setBackground(0xff, 0xff, 0xff); $m-&gt;setDimension(3000,2000); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfsprite.add"> <refnamediv> <refname>SWFSprite->add</refname> <refpurpose>Adds an object to a sprite</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfsprite->add</function></funcdef> <paramdef>ressource <parameter>object</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfsprite->add</function> adds a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function>, a <function>swfaction</function> or a <function>swfsprite</function> object. </para> <para> For displayable types (<function>swfshape</function>, <function>swfbutton</function>, <function>swftext</function>, <function>swfaction</function> or <function>swfsprite</function>), this returns a handle to the object in a display list. </para> </refsect1> </refentry> <refentry id="function.swfsprite.remove"> <refnamediv> <refname>SWFSprite->remove</refname> <refpurpose>Removes an object to a sprite</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfsprite->remove</function></funcdef> <paramdef>ressource <parameter>object</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfsprite->remove</function> remove a <function>swfshape</function>, a <function>swfbutton</function>, a <function>swftext</function>, a <function>swfaction</function> or a <function>swfsprite</function> object from the sprite. </para> </refsect1> </refentry> <refentry id="function.swfsprite.setframes"> <refnamediv> <refname>SWFSprite->setframes</refname> <refpurpose>Sets the total number of frames in the animation.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfsprite->setframes</function></funcdef> <paramdef>integer <parameter>numberofframes</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfsprite->setframes</function> sets the total number of frames in the animation to <parameter>numberofframes</parameter>. </para> </refsect1> </refentry> <refentry id="function.swfsprite.nextframe"> <refnamediv> <refname>SWFSprite->nextframe</refname> <refpurpose>Moves to the next frame of the animation.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfsprite->nextframe</function></funcdef> <paramdef>void </paramdef> </funcprototype> </funcsynopsis> <para> <function>swfsprite->setframes</function> moves to the next frame of the animation. </para> </refsect1> </refentry> <!-- SWFButton --> <refentry id="function.swfbutton"> <refnamediv> <refname>SWFbutton</refname> <refpurpose>Creates a new Button.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfbutton</function></funcdef> <paramdef>void</paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbutton</function> creates a new Button. Roll over it, click it, see it call action code. Swank. </para> <simpara> SWFButton has the following methods : <function>swfbutton->addshape</function>, <function>swfbutton->setup</function>, <function>swfbutton->setover</function> <function>swfbutton->setdown</function>, <function>swfbutton->sethit</function> <function>swfbutton->setaction</function> and <function>swfbutton->addaction</function>. </simpara> <para> This simple example will show your usual interactions with buttons : rollover, rollon, mouseup, mousedown, noaction. <example> <title><function>swfbutton</function> example</title> <programlisting role="php"> &lt;?php $f = new SWFFont("_serif"); $p = new SWFSprite(); function label($string) { global $f; $t = new SWFTextField(); $t-&gt;setFont($f); $t-&gt;addString($string); $t-&gt;setHeight(200); $t-&gt;setBounds(3200,200); return $t; } function addLabel($string) { global $p; $i = $p-&gt;add(label($string)); $p-&gt;nextFrame(); $p-&gt;remove($i); } $p-&gt;add(new SWFAction("stop();")); addLabel("NO ACTION"); addLabel("SWFBUTTON_MOUSEUP"); addLabel("SWFBUTTON_MOUSEDOWN"); addLabel("SWFBUTTON_MOUSEOVER"); addLabel("SWFBUTTON_MOUSEOUT"); addLabel("SWFBUTTON_MOUSEUPOUTSIDE"); addLabel("SWFBUTTON_DRAGOVER"); addLabel("SWFBUTTON_DRAGOUT"); function rect($r, $g, $b) { $s = new SWFShape(); $s-&gt;setRightFill($s-&gt;addFill($r, $g, $b)); $s-&gt;drawLine(600,0); $s-&gt;drawLine(0,600); $s-&gt;drawLine(-600,0); $s-&gt;drawLine(0,-600); return $s; } $b = new SWFButton(); $b-&gt;addShape(rect(0xff, 0, 0), SWFBUTTON_UP | SWFBUTTON_HIT); $b-&gt;addShape(rect(0, 0xff, 0), SWFBUTTON_OVER); $b-&gt;addShape(rect(0, 0, 0xff), SWFBUTTON_DOWN); $b-&gt;addAction(new SWFAction("setTarget('/label'); gotoFrame(1);"), SWFBUTTON_MOUSEUP); $b-&gt;addAction(new SWFAction("setTarget('/label'); gotoFrame(2);"), SWFBUTTON_MOUSEDOWN); $b-&gt;addAction(new SWFAction("setTarget('/label'); gotoFrame(3);"), SWFBUTTON_MOUSEOVER); $b-&gt;addAction(new SWFAction("setTarget('/label'); gotoFrame(4);"), SWFBUTTON_MOUSEOUT); $b-&gt;addAction(new SWFAction("setTarget('/label'); gotoFrame(5);"), SWFBUTTON_MOUSEUPOUTSIDE); $b-&gt;addAction(new SWFAction("setTarget('/label'); gotoFrame(6);"), SWFBUTTON_DRAGOVER); $b-&gt;addAction(new SWFAction("setTarget('/label'); gotoFrame(7);"), SWFBUTTON_DRAGOUT); $m = new SWFMovie(); $m-&gt;setDimension(4000,3000); $i = $m-&gt;add($p); $i-&gt;setName("label"); $i-&gt;moveTo(400,1900); $i = $m-&gt;add($b); $i-&gt;moveTo(400,900); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> <para> This simple example will enables you to drag draw a big red button on the windows. No drag-and-drop, just moving around. <example> <title><function>swfbutton->addaction</function> example</title> <programlisting role="php"> &lt;?php $s = new SWFShape(); $s-&gt;setRightFill($s-&gt;addFill(0xff, 0, 0)); $s-&gt;drawLine(1000,0); $s-&gt;drawLine(0,1000); $s-&gt;drawLine(-1000,0); $s-&gt;drawLine(0,-1000); $b = new SWFButton(); $b-&gt;addShape($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER); $b-&gt;addAction(new SWFAction("startDrag('/test', 0);"), // '0' means don't lock to mouse SWFBUTTON_MOUSEDOWN); $b-&gt;addAction(new SWFAction("stopDrag();"), SWFBUTTON_MOUSEUP | SWFBUTTON_MOUSEUPOUTSIDE); $p = new SWFSprite(); $p-&gt;add($b); $p-&gt;nextFrame(); $m = new SWFMovie(); $i = $m-&gt;add($p); $i-&gt;setName('test'); $i-&gt;moveTo(1000,1000); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> <refentry id="function.swfbutton.addshape"> <refnamediv> <refname>SWFbutton->addShape</refname> <refpurpose>Adds a shape to a button</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfbutton->addshape</function></funcdef> <paramdef>ressource <parameter>shape</parameter></paramdef> <paramdef>integer <parameter>flags</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbutton->addshape</function> adds the shape <parameter>shape</parameter> to this button. The following <parameter>flags</parameter>' values are valid: SWFBUTTON_UP, SWFBUTTON_OVER, SWFBUTTON_DOWN or SWFBUTTON_HIT. SWFBUTTON_HIT isn't ever displayed, it defines the hit region for the button. That is, everywhere the hit shape would be drawn is considered a "touchable" part of the button. </para> </refsect1> </refentry> <refentry id="function.swfbutton.setup"> <refnamediv> <refname>SWFbutton->setUp</refname> <refpurpose>Alias for addShape(shape, SWFBUTTON_UP)</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfbutton->setup</function></funcdef> <paramdef>ressource <parameter>shape</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbutton->setup</function> alias for addShape(shape, SWFBUTTON_UP). </para> </refsect1> </refentry> <refentry id="function.swfbutton.setover"> <refnamediv> <refname>SWFbutton->setOver</refname> <refpurpose>Alias for addShape(shape, SWFBUTTON_OVER)</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfbutton->setover</function></funcdef> <paramdef>ressource <parameter>shape</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbutton->setup</function> alias for addShape(shape, SWFBUTTON_OVER). </para> </refsect1> </refentry> <refentry id="function.swfbutton.sethit"> <refnamediv> <refname>SWFbutton->setHit</refname> <refpurpose>Alias for addShape(shape, SWFBUTTON_HIT)</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfbutton->sethit</function></funcdef> <paramdef>ressource <parameter>shape</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbutton->sethit</function> alias for addShape(shape, SWFBUTTON_HIT). </para> </refsect1> </refentry> <refentry id="function.swfbutton.setAction"> <refnamediv> <refname>SWFbutton->setAction</refname> <refpurpose>Sets the action</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>void <function>swfbutton->setaction</function></funcdef> <paramdef>ressource <parameter>action</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfbutton->setaction</function> sets the action to be performed when the button is clicked. Alias for addAction(shape, SWFBUTTON_MOUSEUP). <parameter>action</parameter> is a <function>swfaction</function>. </para> </refsect1> </refentry> <!-- SWFAction --> <refentry id="function.swfaction"> <refnamediv> <refname>SWFAction</refname> <refpurpose>Creates a new Action.</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>new <function>swfaction</function></funcdef> <paramdef>string <parameter>script</parameter></paramdef> </funcprototype> </funcsynopsis> <para> <function>swfaction</function> creates a new Action, and compiles the given script into an SWFAction object. </para> <para> The script syntax is based on the C language, but with a lot taken out- the SWF bytecode machine is just too simpleminded to do a lot of things we might like. For instance, we can't implement function calls without a tremendous amount of hackery because the jump bytecode has a hardcoded offset value. No pushing your calling address to the stack and returning- every function would have to know exactly where to return to. </para> <para> So what's left? The compiler recognises the following tokens: <itemizedlist> <listitem> <simpara> break </simpara> </listitem> <listitem> <simpara> for </simpara> </listitem> <listitem> <simpara> continue </simpara> </listitem> <listitem> <simpara> if </simpara> </listitem> <listitem> <simpara> else </simpara> </listitem> <listitem> <simpara> do </simpara> </listitem> <listitem> <simpara> while </simpara> </listitem> </itemizedlist> </para> <para> There is no typed data; all values in the SWF action machine are stored as strings. The following functions can be used in expressions: <variablelist> <varlistentry> <term>time()</term> <listitem> <simpara> Returns the number of milliseconds (?) elapsed since the movie started. </simpara> </listitem> </varlistentry> <varlistentry> <term>random(seed)</term> <listitem> <simpara> Returns a pseudo-random number in the range 0-seed. </simpara> </listitem> </varlistentry> <varlistentry> <term>length(expr)</term> <listitem> <simpara> Returns the length of the given expression. </simpara> </listitem> </varlistentry> <varlistentry> <term>int(number)</term> <listitem> <simpara> Returns the given number rounded down to the nearest integer. </simpara> </listitem> </varlistentry> <varlistentry> <term>concat(expr, expr)</term> <listitem> <simpara> Returns the concatenation of the given expressions. </simpara> </listitem> </varlistentry> <varlistentry> <term>ord(expr)</term> <listitem> <simpara> Returns the ASCII code for the given character </simpara> </listitem> </varlistentry> <varlistentry> <term>chr(num)</term> <listitem> <simpara> Returns the character for the given ASCII code </simpara> </listitem> </varlistentry> <varlistentry> <term>substr(string, location, length)</term> <listitem> <simpara> Returns the substring of length length at location location of the given string string. </simpara> </listitem> </varlistentry> </variablelist> </para> <para> Additionally, the following commands may be used: <variablelist> <varlistentry> <term>duplicateClip(clip, name, depth)</term> <listitem> <simpara> Duplicate the named movie clip (aka sprite). The new movie clip has name name and is at depth depth. </simpara> </listitem> </varlistentry> <varlistentry> <term>removeClip(expr)</term> <listitem> <simpara> Removes the named movie clip. </simpara> </listitem> </varlistentry> <varlistentry> <term>trace(expr)</term> <listitem> <simpara> Write the given expression to the trace log. Doubtful that the browser plugin does anything with this. </simpara> </listitem> </varlistentry> <varlistentry> <term>startDrag(target, lock, [left, top, right, bottom])</term> <listitem> <simpara> Start dragging the movie clip target. The lock argument indicates whether to lock the mouse (?)- use 0 (false) or 1 (true). Optional parameters define a bounding area for the dragging. </simpara> </listitem> </varlistentry> <varlistentry> <term>stopDrag()</term> <listitem> <simpara> Stop dragging my heart around. And this movie clip, too. </simpara> </listitem> </varlistentry> <varlistentry> <term>callFrame(expr)</term> <listitem> <simpara> Call the named frame as a function. </simpara> </listitem> </varlistentry> <varlistentry> <term>getURL(url, target, [method])</term> <listitem> <simpara> Load the given url into the named target. The target argument can be a frame name (I think), or one of the magical values "_level0" (replaces current movie) or "_level1" (loads new movie on top of current movie). The optional method argument can be post or get if you want to submit variables back to the server. </simpara> </listitem> </varlistentry> <varlistentry> <term>loadMovie(url, target)</term> <listitem> <simpara> Same as above, more or less. Come to think of it, I don't quite know what the difference is. </simpara> </listitem> </varlistentry> <varlistentry> <term>nextFrame()</term> <listitem> <simpara> Go to the next frame. </simpara> </listitem> </varlistentry> <varlistentry> <term>prevFrame()</term> <listitem> <simpara> Go to the last (or, rather, previous) frame. </simpara> </listitem> </varlistentry> <varlistentry> <term>play()</term> <listitem> <simpara> Start playing the movie. </simpara> </listitem> </varlistentry> <varlistentry> <term>stop()</term> <listitem> <simpara> Stop playing the movie. </simpara> </listitem> </varlistentry> <varlistentry> <term>toggleQuality()</term> <listitem> <simpara> Toggle between high and low quality. </simpara> </listitem> </varlistentry> <varlistentry> <term>stopSounds()</term> <listitem> <simpara> Stop playing all sounds. </simpara> </listitem> </varlistentry> <varlistentry> <term>gotoFrame(num)</term> <listitem> <simpara> Go to frame number num. Frame numbers start at 0. </simpara> </listitem> </varlistentry> <varlistentry> <term>gotoFrame(name)</term> <listitem> <simpara> Go to the frame named name. Which does a lot of good, since I haven't added frame labels yet. </simpara> </listitem> </varlistentry> <varlistentry> <term>setTarget(expr)</term> <listitem> <simpara> Sets the context for action. Or so they say- I really have no idea what this does. </simpara> </listitem> </varlistentry> </variablelist> And there's one weird extra thing. The expression frameLoaded(num) can be used in if statements and while loops to check if the given frame number has been loaded yet. Well, it's supposed to, anyway, but I've never tested it and I seriously doubt it actually works. You can just use /:framesLoaded instead. </para> <para> Movie clips (all together now- aka sprites) have properties. You can read all of them (or can you?), you can set some of them, and here they are: <itemizedlist> <listitem> <simpara> x </simpara> </listitem> <listitem> <simpara> y </simpara> </listitem> <listitem> <simpara> xScale </simpara> </listitem> <listitem> <simpara> yScale </simpara> </listitem> <listitem> <simpara> currentFrame - (read-only) </simpara> </listitem> <listitem> <simpara> totalFrames - (read-only) </simpara> </listitem> <listitem> <simpara> alpha - transparency level </simpara> </listitem> <listitem> <simpara> visible - 1=on, 0=off (?) </simpara> </listitem> <listitem> <simpara> width - (read-only) </simpara> </listitem> <listitem> <simpara> height - (read-only) </simpara> </listitem> <listitem> <simpara> rotation </simpara> </listitem> <listitem> <simpara> target - (read-only) (???) </simpara> </listitem> <listitem> <simpara> framesLoaded - (read-only) </simpara> </listitem> <listitem> <simpara> name </simpara> </listitem> <listitem> <simpara> dropTarget - (read-only) (???) </simpara> </listitem> <listitem> <simpara> url - (read-only) (???) </simpara> </listitem> <listitem> <simpara> highQuality - 1=high, 0=low (?) </simpara> </listitem> <listitem> <simpara> focusRect - (???) </simpara> </listitem> <listitem> <simpara> soundBufTime - (???) </simpara> </listitem> </itemizedlist> So, setting a sprite's x position is as simple as <literal>/box.x = 100;</literal>. Why the slash in front of the box, though? That's how flash keeps track of the sprites in the movie, just like a unix filesystem- here it shows that box is at the top level. If the sprite named box had another sprite named biff inside of it, you'd set its x position with /box/biff.x = 100;. At least, I think so; correct me if I'm wrong here. </para> <para> This simple example will move the red square across the window. <example> <title><function>swfaction</function> example</title> <programlisting role="php"> &lt;?php $s = new SWFShape(); $f = $s-&gt;addFill(0xff, 0, 0); $s-&gt;setRightFill($f); $s-&gt;movePenTo(-500,-500); $s-&gt;drawLineTo(500,-500); $s-&gt;drawLineTo(500,500); $s-&gt;drawLineTo(-500,500); $s-&gt;drawLineTo(-500,-500); $p = new SWFSprite(); $i = $p-&gt;add($s); $i-&gt;setDepth(1); $p-&gt;nextFrame(); for($n=0; $n<5; ++$n) { $i-&gt;rotate(-15); $p-&gt;nextFrame(); } $m = new SWFMovie(); $m-&gt;setBackground(0xff, 0xff, 0xff); $m-&gt;setDimension(6000,4000); $i = $m-&gt;add($p); $i-&gt;setDepth(1); $i-&gt;moveTo(-500,2000); $i-&gt;setName("box"); $m-&gt;add(new SWFAction("/box.x += 3;")); $m-&gt;nextFrame(); $m-&gt;add(new SWFAction("gotoFrame(0); play();")); $m-&gt;nextFrame(); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> <para> This simple example tracks down your mouse on the screen. <example> <title><function>swfaction</function> example</title> <programlisting role="php"> &lt;?php $m = new SWFMovie(); $m-&gt;setRate(36.0); $m-&gt;setDimension(1200, 800); $m-&gt;setBackground(0, 0, 0); /* mouse tracking sprite - empty, but follows mouse so we can get its x and y coordinates */ $i = $m-&gt;add(new SWFSprite()); $i-&gt;setName('mouse'); $m-&gt;add(new SWFAction(" startDrag('/mouse', 1); /* '1' means lock sprite to the mouse */ ")); /* might as well turn off antialiasing, since these are just squares. */ $m-&gt;add(new SWFAction(" this.quality = 0; ")); /* morphing box */ $r = new SWFMorph(); $s = $r-&gt;getShape1(); /* Note this is backwards from normal shapes. No idea why. */ $s-&gt;setLeftFill($s-&gt;addFill(0xff, 0xff, 0xff)); $s-&gt;movePenTo(-40, -40); $s-&gt;drawLine(80, 0); $s-&gt;drawLine(0, 80); $s-&gt;drawLine(-80, 0); $s-&gt;drawLine(0, -80); $s = $r-&gt;getShape2(); $s-&gt;setLeftFill($s-&gt;addFill(0x00, 0x00, 0x00)); $s-&gt;movePenTo(-1, -1); $s-&gt;drawLine(2, 0); $s-&gt;drawLine(0, 2); $s-&gt;drawLine(-2, 0); $s-&gt;drawLine(0, -2); /* sprite container for morphing box - this is just a timeline w/ the box morphing */ $box = new SWFSprite(); $box-&gt;add(new SWFAction(" stop(); ")); $i = $box-&gt;add($r); for($n=0; $n<=20; ++$n) { $i-&gt;setRatio($n/20); $box-&gt;nextFrame(); } /* this container sprite allows us to use the same action code many times */ $cell = new SWFSprite(); $i = $cell-&gt;add($box); $i-&gt;setName('box'); $cell-&gt;add(new SWFAction(" setTarget('box'); /* ...x means the x coordinate of the parent, i.e. (..).x */ dx = (/mouse.x + random(6)-3 - ...x)/5; dy = (/mouse.y + random(6)-3 - ...y)/5; gotoFrame(int(dx*dx + dy*dy)); ")); $cell-&gt;nextFrame(); $cell-&gt;add(new SWFAction(" gotoFrame(0); play(); ")); $cell-&gt;nextFrame(); /* finally, add a bunch of the cells to the movie */ for($x=0; $x<12; ++$x) { for($y=0; $y<8; ++$y) { $i = $m-&gt;add($cell); $i-&gt;moveTo(100*$x+50, 100*$y+50); } } $m-&gt;nextFrame(); $m-&gt;add(new SWFAction(" gotoFrame(1); play(); ")); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> <para> Same as above, but with nice colored balls... <example> <title><function>swfaction</function> example</title> <programlisting role="php"> &lt;?php $m = new SWFMovie(); $m-&gt;setDimension(11000, 8000); $m-&gt;setBackground(0x00, 0x00, 0x00); $m-&gt;add(new SWFAction(" this.quality = 0; /frames.visible = 0; startDrag('/mouse', 1); ")); // mouse tracking sprite $t = new SWFSprite(); $i = $m-&gt;add($t); $i-&gt;setName('mouse'); $g = new SWFGradient(); $g-&gt;addEntry(0, 0xff, 0xff, 0xff, 0xff); $g-&gt;addEntry(0.1, 0xff, 0xff, 0xff, 0xff); $g-&gt;addEntry(0.5, 0xff, 0xff, 0xff, 0x5f); $g-&gt;addEntry(1.0, 0xff, 0xff, 0xff, 0); // gradient shape thing $s = new SWFShape(); $f = $s-&gt;addFill($g, SWFFILL_RADIAL_GRADIENT); $f-&gt;scaleTo(0.03); $s-&gt;setRightFill($f); $s-&gt;movePenTo(-600, -600); $s-&gt;drawLine(1200, 0); $s-&gt;drawLine(0, 1200); $s-&gt;drawLine(-1200, 0); $s-&gt;drawLine(0, -1200); // need to make this a sprite so we can multColor it $p = new SWFSprite(); $p-&gt;add($s); $p-&gt;nextFrame(); // put the shape in here, each frame a different color $q = new SWFSprite(); $q-&gt;add(new SWFAction("gotoFrame(random(7)+1); stop();")); $i = $q-&gt;add($p); $i-&gt;multColor(1.0, 1.0, 1.0); $q-&gt;nextFrame(); $i-&gt;multColor(1.0, 0.5, 0.5); $q-&gt;nextFrame(); $i-&gt;multColor(1.0, 0.75, 0.5); $q-&gt;nextFrame(); $i-&gt;multColor(1.0, 1.0, 0.5); $q-&gt;nextFrame(); $i-&gt;multColor(0.5, 1.0, 0.5); $q-&gt;nextFrame(); $i-&gt;multColor(0.5, 0.5, 1.0); $q-&gt;nextFrame(); $i-&gt;multColor(1.0, 0.5, 1.0); $q-&gt;nextFrame(); // finally, this one contains the action code $p = new SWFSprite(); $i = $p-&gt;add($q); $i-&gt;setName('frames'); $p-&gt;add(new SWFAction(" dx = (/:mousex-/:lastx)/3 + random(10)-5; dy = (/:mousey-/:lasty)/3; x = /:mousex; y = /:mousey; alpha = 100; ")); $p-&gt;nextFrame(); $p-&gt;add(new SWFAction(" this.x = x; this.y = y; this.alpha = alpha; x += dx; y += dy; dy += 3; alpha -= 8; ")); $p-&gt;nextFrame(); $p-&gt;add(new SWFAction("prevFrame(); play();")); $p-&gt;nextFrame(); $i = $m-&gt;add($p); $i-&gt;setName('frames'); $m-&gt;nextFrame(); $m-&gt;add(new SWFAction(" lastx = mousex; lasty = mousey; mousex = /mouse.x; mousey = /mouse.y; ++num; if(num == 11) num = 1; removeClip('char' & num); duplicateClip(/frames, 'char' & num, num); ")); $m-&gt;nextFrame(); $m-&gt;add(new SWFAction("prevFrame(); play();")); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> <para> This simple example will handles keyboard actions. (You'll probably have to click in the window to give it focus. And you'll probably have to leave your mouse in the frame, too. If you know how to give buttons focus programatically, feel free to share, won't you?) <example> <title><function>swfaction</function> example</title> <programlisting role="php"> &lt;?php /* sprite has one letter per frame */ $p = new SWFSprite(); $p-&gt;add(new SWFAction("stop();")); $chars = "abcdefghijklmnopqrstuvwxyz". "ABCDEFGHIJKLMNOPQRSTUVWXYZ". "1234567890!@#$%^&*()_+-=/[]{}|;:,.<>?`~"; $f = new SWFFont("_sans"); for($n=0; $nremove($i); $t = new SWFTextField(); $t-&gt;setFont($f); $t-&gt;setHeight(240); $t-&gt;setBounds(600,240); $t-&gt;align(SWFTEXTFIELD_ALIGN_CENTER); $t-&gt;addString($c); $i = $p-&gt;add($t); $p-&gt;labelFrame($c); $p-&gt;nextFrame(); } /* hit region for button - the entire frame */ $s = new SWFShape(); $s-&gt;setFillStyle0($s-&gt;addSolidFill(0, 0, 0, 0)); $s-&gt;drawLine(600, 0); $s-&gt;drawLine(0, 400); $s-&gt;drawLine(-600, 0); $s-&gt;drawLine(0, -400); /* button checks for pressed key, sends sprite to the right frame */ $b = new SWFButton(); $b-&gt;addShape($s, SWFBUTTON_HIT); for($n=0; $naddAction(new SWFAction(" setTarget('/char'); gotoFrame('$c'); "), SWFBUTTON_KEYPRESS($c)); } $m = new SWFMovie(); $m-&gt;setDimension(600,400); $i = $m-&gt;add($p); $i-&gt;setName('char'); $i-&gt;moveTo(0,80); $m-&gt;add($b); header('Content-type: application/x-shockwave-flash'); $m-&gt;output(); ?&gt; </programlisting> </example> </para> </refsect1> </refentry> </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: -->
« previous php.doc (#969334910) next »