[PHP-DOC] cvs: phpdoc /ja Translators /ja/chapters config.xml install.xml /ja/functions filesystem.xml ming.xml openssl.xml outcontrol.xml uodbc.xml
by Rui Hirokawa other posts by this author
Apr 5 2001 3:09PM messages near this date
[PHP-DOC] "YourName.BEST321.com" FREE §K¶O°ì¦W !!!!!
|
Re: [PHP-DOC] huidziekte
This is a MIME encoded message
--hirokawa986483357
Content-Type: text/plain
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.
--hirokawa986483357
Content-Type: text/plain
Content-Disposition: attachment; filename="hirokawa-20010405080917.txt"
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> <? ?></userinput> ã使ç¨å¯è½ã«
- ãããã©ãããè¨å®ãã¾ãã
- PHPãXMLã¨çµã¿åããã¦ç¨ããå ´åã¯ããã®ãªãã·ã§ã³ã
- ãªãã«ããå¿
è¦ãããã¾ãã
+ PHP ã¿ã°ã®ç縮å (<userinput> <? ?></userinput>) ã使ç¨
+ å¯è½ã«ãããã©ãããè¨å®ãã¾ããPHPãXMLã¨çµã¿åããã¦ç¨ãã
+ å ´åã¯ããã®ãªãã·ã§ã³ããªãã«ããå¿
è¦ãããã¾ãã
ããããªãã«ããå ´åãé·ãæ¹ã®å½¢å¼ã®ã¿ã°
(<userinput> <?php ?></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">
+<?php
+
+$path_parts = pathinfo("/www/htdocs/index.html");
+
+echo $path_parts["dirname"] . "\n";
+echo $path_parts["basename"] . "\n";
+echo $path_parts["extension"] . "\n";
+
+?>
+ </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 >= 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 . "<br>";
+ </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 = <<<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" => "nighthawk@agent.com", // 飿³é
åã®æ§æ
+ "From: HQ <hq@cia.com>", // æ·»åé
åã®æ§æ
+ "Subject" => "Eyes only")))
+{
+ // ã¡ãã»ã¼ã¸ãæå·åããéä¿¡ãã¾ã!
+ exec(ini_get("sendmail_path") . " < 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 = <<<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" => "joes@sales.com", // keyed syntax
+ "From: HQ <ceo@sales.com>", // indexed syntax
+ "Subject" => "Eyes only"))
+{
+ // message signed - send it!
+ exec(ini_get("sendmail_path") . " < 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ãµã¤ã³ãããã¡ãã»ã¼ã¸ã®ãµã¤ã³ã確èªãã</refpurp
ose>
+ </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">
-<php
+<?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ã¯ãli
bswf
ã§ãµãã¼ãããããã©ãããã©ã¼ã ã«ã¯å
¥ã£ã¦ãã¾ããã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 <phpdir> /ext/ming
cp php_ext/* <phpdir> /ext/ming
cd <phpdir>
./buildconf
./configure --with-ming <other config options>
</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">
<?php
header('Content-type: application/x-shockwave-flash');
?>
</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">
<?php
$m = new SWFMovie();
$m->setRate(12.0);
$m->streamMp3("distortobass.mp3");
// use your own MP3
// 11.85 seconds at 12.0 fps = 142 frames
$m->setFrames(142);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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</functio
n> ,
<function> swfdisplayitem->scale</function>, <function>swfdisplayitem->rotate</function>
,
<function> swfdisplayitem->rotateto</function>, <function>swfdisplayitem->skewxto</funct
ion> ,
<function> swfdisplayitem->skewx</function>, <function>swfdisplayitem->skewyto</function
>
<function> swfdisplayitem->skewyto</function>, <function>swfdisplayitem->setdepth</funct
ion>
<function> swfdisplayitem->remove</function>, <function>swfdisplayitem->setname</functio
n>
<function> swfdisplayitem->setratio</function>, <function>swfdisplayitem->addcolor</func
tion>
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">
<?php
$thetext = "ming!";
$f = new SWFFont("Bauhaus 93.fdb");
$m = new SWFMovie();
$m->setRate(24.0);
$m->setDimension(2400, 1600);
$m->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->setFont($f);
$t->setColor($r, $g, $b, $a);
$t->setHeight(960);
$t->moveTo(-($f->getWidth($string))/2, $f->getAscent()/2);
$t->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->scale, because that's a function
$i = $m->add($t);
$i->x = $x;
$i->y = $y;
$i->rot = $rot;
$i->s = $scale;
$i->rotateTo($rot);
$i->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->rot;
$i->rot = 19*$i->rot/20;
$i->x = (19*$i->x + 1200)/20;
$i->y = (19*$i->y + 800)/20;
$i->s = (19*$i->s + 1.0)/20;
$i->rotateTo($i->rot);
$i->scaleTo($i->s, $i->s);
$i->moveTo($i->x, $i->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->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$p = new SWFMorph();
$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(0.16, 0xff, 0xff, 0xff);
$g->addEntry(0.32, 0, 0, 0);
$g->addEntry(0.48, 0xff, 0xff, 0xff);
$g->addEntry(0.64, 0, 0, 0);
$g->addEntry(0.80, 0xff, 0xff, 0xff);
$g->addEntry(1.00, 0, 0, 0);
$s = $p->getShape1();
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.05);
$s->setLeftFill($f);
$s->movePenTo(-160, -120);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(0.16, 0xff, 0, 0);
$g->addEntry(0.32, 0, 0, 0);
$g->addEntry(0.48, 0, 0xff, 0);
$g->addEntry(0.64, 0, 0, 0);
$g->addEntry(0.80, 0, 0, 0xff);
$g->addEntry(1.00, 0, 0, 0);
$s = $p->getShape2();
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.05);
$f->skewXTo(1.0);
$s->setLeftFill($f);
$s->movePenTo(-160, -120);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$m = new SWFMovie();
$m->setDimension(320, 240);
$i = $m->add($p);
$i->moveTo(160, 120);
for($n=0; $n<=1.001; $n+=0.01)
{
$i->setRatio($n);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$b = new SWFBitmap("backyard.jpg");
// note use your own picture :-)
$s = new SWFShape();
$s->setRightFill($s->addFill($b));
$s->drawLine($b->getWidth(), 0);
$s->drawLine(0, $b->getHeight());
$s->drawLine(-$b->getWidth(), 0);
$s->drawLine(0, -$b->getHeight());
$m = new SWFMovie();
$m->setDimension($b->getWidth(), $b->getHeight());
$i = $m->add($s);
for($n=0; $n<=20; ++$n)
{
$i->multColor(1.0-$n/10, 1.0, 1.0);
$i->addColor(0xff*$n/20, 0, 0);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$s = new SWFShape();
$s->setLine(40, 0x7f, 0, 0);
$s->setRightFill($s->addFill(0xff, 0, 0));
$s->movePenTo(200, 200);
$s->drawLineTo(6200, 200);
$s->drawLineTo(6200, 4600);
$s->drawCurveTo(200, 4600, 200, 200);
$m = new SWFMovie();
$m->setDimension(6400, 4800);
$m->setRate(12.0);
$m->add($s);
$m->nextFrame();
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$s = new SWFShape();
$f1 = $s->addFill(0xff, 0, 0);
$f2 = $s->addFill(0xff, 0x7f, 0);
$f3 = $s->addFill(0xff, 0xff, 0);
$f4 = $s->addFill(0, 0xff, 0);
$f5 = $s->addFill(0, 0, 0xff);
// bug: have to declare all line styles before you use them
$s->setLine(40, 0x7f, 0, 0);
$s->setLine(40, 0x7f, 0x3f, 0);
$s->setLine(40, 0x7f, 0x7f, 0);
$s->setLine(40, 0, 0x7f, 0);
$s->setLine(40, 0, 0, 0x7f);
$f = new SWFFont('Techno.fdb');
$s->setRightFill($f1);
$s->setLine(40, 0x7f, 0, 0);
$s->drawGlyph($f, '!');
$s->movePen($f->getWidth('!'), 0);
$s->setRightFill($f2);
$s->setLine(40, 0x7f, 0x3f, 0);
$s->drawGlyph($f, '#');
$s->movePen($f->getWidth('#'), 0);
$s->setRightFill($f3);
$s->setLine(40, 0x7f, 0x7f, 0);
$s->drawGlyph($f, '%');
$s->movePen($f->getWidth('%'), 0);
$s->setRightFill($f4);
$s->setLine(40, 0, 0x7f, 0);
$s->drawGlyph($f, '*');
$s->movePen($f->getWidth('*'), 0);
$s->setRightFill($f5);
$s->setLine(40, 0, 0, 0x7f);
$s->drawGlyph($f, '@');
$m = new SWFMovie();
$m->setDimension(3000,2000);
$m->setRate(12.0);
$i = $m->add($s);
$i->moveTo(1500-$f->getWidth("!#%*@")/2, 1000+$f->getAscent()/2);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$p = new SWFMorph();
$b = new SWFBitmap("alphafill.jpg");
// use your own bitmap
$width = $b->getWidth();
$height = $b->getHeight();
$s = $p->getShape1();
$f = $s->addFill($b, SWFFILL_TILED_BITMAP);
$f->moveTo(-$width/2, -$height/4);
$f->scaleTo(1.0, 0.5);
$s->setLeftFill($f);
$s->movePenTo(-$width/2, -$height/4);
$s->drawLine($width, 0);
$s->drawLine(0, $height/2);
$s->drawLine(-$width, 0);
$s->drawLine(0, -$height/2);
$s = $p->getShape2();
$f = $s->addFill($b, SWFFILL_TILED_BITMAP);
// these two have no effect!
$f->moveTo(-$width/4, -$height/2);
$f->scaleTo(0.5, 1.0);
$s->setLeftFill($f);
$s->movePenTo(-$width/4, -$height/2);
$s->drawLine($width/2, 0);
$s->drawLine(0, $height);
$s->drawLine(-$width/2, 0);
$s->drawLine(0, -$height);
$m = new SWFMovie();
$m->setDimension($width, $height);
$i = $m->add($p);
$i->moveTo($width/2, $height/2);
for($n=0; $n<1.001; $n+=0.03)
{
$i->setRatio($n);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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 cou
nter-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">
<?php
$m = new SWFMovie();
$m->setDimension(320, 240);
$s = new SWFShape();
// first gradient- black to white
$g = new SWFGradient();
$g->addEntry(0.0, 0, 0, 0);
$g->addEntry(1.0, 0xff, 0xff, 0xff);
$f = $s->addFill($g, SWFFILL_LINEAR_GRADIENT);
$f->scaleTo(0.01);
$f->moveTo(160, 120);
$s->setRightFill($f);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$m->add($s);
$s = new SWFShape();
// second gradient- radial gradient from red to transparent
$g = new SWFGradient();
$g->addEntry(0.0, 0xff, 0, 0, 0xff);
$g->addEntry(1.0, 0xff, 0, 0, 0);
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.005);
$f->moveTo(160, 120);
$s->setRightFill($f);
$s->drawLine(320, 0);
$s->drawLine(0, 240);
$s->drawLine(-320, 0);
$s->drawLine(0, -240);
$m->add($s);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$s = new SWFShape();
$f = $s->addFill(new SWFBitmap("png.dbl"));
$s->setRightFill($f);
$s->drawLine(32, 0);
$s->drawLine(0, 32);
$s->drawLine(-32, 0);
$s->drawLine(0, -32);
$m = new SWFMovie();
$m->setDimension(32, 32);
$m->add($s);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$s = new SWFShape();
// .msk file generated with "gif2mask" utility
$f = $s->addFill(new SWFBitmap("alphafill.jpg", "alphafill.msk"));
$s->setRightFill($f);
$s->drawLine(640, 0);
$s->drawLine(0, 480);
$s->drawLine(-640, 0);
$s->drawLine(0, -480);
$c = new SWFShape();
$c->setRightFill($c->addFill(0x99, 0x99, 0x99));
$c->drawLine(40, 0);
$c->drawLine(0, 40);
$c->drawLine(-40, 0);
$c->drawLine(0, -40);
$m = new SWFMovie();
$m->setDimension(640, 480);
$m->setBackground(0xcc, 0xcc, 0xcc);
// draw checkerboard background
for($y=0; $y<480; $y+=40)
{
for($x=0; $x<640; $x+=80)
{
$i = $m->add($c);
$i->moveTo($x, $y);
}
$y+=40;
for($x=40; $x<640; $x+=80)
{
$i = $m->add($c);
$i->moveTo($x, $y);
}
}
$m->add($s);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$p = new SWFMorph();
$s = $p->getShape1();
$s->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->setLeftFill($s->addFill(0xff, 0, 0));
$s->movePenTo(-1000,-1000);
$s->drawLine(2000,0);
$s->drawLine(0,2000);
$s->drawLine(-2000,0);
$s->drawLine(0,-2000);
$s = $p->getShape2();
$s->setLine(60,0,0,0);
$s->setLeftFill($s->addFill(0, 0, 0xff));
$s->movePenTo(0,-1000);
$s->drawLine(1000,1000);
$s->drawLine(-1000,1000);
$s->drawLine(-1000,-1000);
$s->drawLine(1000,-1000);
$m = new SWFMovie();
$m->setDimension(3000,2000);
$m->setBackground(0xff, 0xff, 0xff);
$i = $m->add($p);
$i->moveTo(1500,1000);
for($r=0.0; $r<=1.0; $r+=0.1)
{
$i->setRatio($r);
$m->nextFrame();
}
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$f = new SWFFont("Techno.fdb");
$t = new SWFText();
$t->setFont($f);
$t->moveTo(200, 2400);
$t->setColor(0xff, 0xff, 0);
$t->setHeight(1200);
$t->addString("PHP generates Flash with Ming!!");
$m = new SWFMovie();
$m->setDimension(5400, 3600);
$m->add($t);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$f = newSWFFont("_sans");
?>
</programlisting>
will give you the standard sans-serif font, probably the same as what you'd get
with <literal> <font name="sans-serif"></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 whi
ch
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">
<?php
$t = newSWFTextField(SWFTEXTFIELD_PASSWORD | SWFTEXTFIELD_NOEDIT);
?>
</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</fu
nction> ,
<function> swftextfield->setrightmargin</function>, <function>swftextfield->setmargins</
function> ,
<function> swftextfield->setindentation</function>, <function>swftextfield->setlinespaci
ng</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">
<?php
$s = new SWFShape();
$s->setRightFill($s->addFill(0xff, 0, 0));
$s->movePenTo(-500,-500);
$s->drawLineTo(500,-500);
$s->drawLineTo(500,500);
$s->drawLineTo(-500,500);
$s->drawLineTo(-500,-500);
$p = new SWFSprite();
$i = $p->add($s);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$i->rotate(15);
$p->nextFrame();
$m = new SWFMovie();
$i = $m->add($p);
$i->moveTo(1500,1000);
$i->setName("blah");
$m->setBackground(0xff, 0xff, 0xff);
$m->setDimension(3000,2000);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$f = new SWFFont("_serif");
$p = new SWFSprite();
function label($string)
{
global $f;
$t = new SWFTextField();
$t->setFont($f);
$t->addString($string);
$t->setHeight(200);
$t->setBounds(3200,200);
return $t;
}
function addLabel($string)
{
global $p;
$i = $p->add(label($string));
$p->nextFrame();
$p->remove($i);
}
$p->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->setRightFill($s->addFill($r, $g, $b));
$s->drawLine(600,0);
$s->drawLine(0,600);
$s->drawLine(-600,0);
$s->drawLine(0,-600);
return $s;
}
$b = new SWFButton();
$b->addShape(rect(0xff, 0, 0), SWFBUTTON_UP | SWFBUTTON_HIT);
$b->addShape(rect(0, 0xff, 0), SWFBUTTON_OVER);
$b->addShape(rect(0, 0, 0xff), SWFBUTTON_DOWN);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(1);"),
SWFBUTTON_MOUSEUP);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(2);"),
SWFBUTTON_MOUSEDOWN);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(3);"),
SWFBUTTON_MOUSEOVER);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(4);"),
SWFBUTTON_MOUSEOUT);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(5);"),
SWFBUTTON_MOUSEUPOUTSIDE);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(6);"),
SWFBUTTON_DRAGOVER);
$b->addAction(new SWFAction("setTarget('/label'); gotoFrame(7);"),
SWFBUTTON_DRAGOUT);
$m = new SWFMovie();
$m->setDimension(4000,3000);
$i = $m->add($p);
$i->setName("label");
$i->moveTo(400,1900);
$i = $m->add($b);
$i->moveTo(400,900);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$s = new SWFShape();
$s->setRightFill($s->addFill(0xff, 0, 0));
$s->drawLine(1000,0);
$s->drawLine(0,1000);
$s->drawLine(-1000,0);
$s->drawLine(0,-1000);
$b = new SWFButton();
$b->addShape($s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
$b->addAction(new SWFAction("startDrag('/test', 0);"), // '0' means don't lock to mouse
SWFBUTTON_MOUSEDOWN);
$b->addAction(new SWFAction("stopDrag();"),
SWFBUTTON_MOUSEUP | SWFBUTTON_MOUSEUPOUTSIDE);
$p = new SWFSprite();
$p->add($b);
$p->nextFrame();
$m = new SWFMovie();
$i = $m->add($p);
$i->setName('test');
$i->moveTo(1000,1000);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
$s = new SWFShape();
$f = $s->addFill(0xff, 0, 0);
$s->setRightFill($f);
$s->movePenTo(-500,-500);
$s->drawLineTo(500,-500);
$s->drawLineTo(500,500);
$s->drawLineTo(-500,500);
$s->drawLineTo(-500,-500);
$p = new SWFSprite();
$i = $p->add($s);
$i->setDepth(1);
$p->nextFrame();
for($n=0; $n<5; ++$n)
{
$i->rotate(-15);
$p->nextFrame();
}
$m = new SWFMovie();
$m->setBackground(0xff, 0xff, 0xff);
$m->setDimension(6000,4000);
$i = $m->add($p);
$i->setDepth(1);
$i->moveTo(-500,2000);
$i->setName("box");
$m->add(new SWFAction("/box.x += 3;"));
$m->nextFrame();
$m->add(new SWFAction("gotoFrame(0); play();"));
$m->nextFrame();
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</programlisting>
</example>
</para>
<para>
This simple example tracks down your mouse on the screen.
<example>
<title> <function>swfaction</function> example</title>
<programlisting role="php">
<?php
$m = new SWFMovie();
$m->setRate(36.0);
$m->setDimension(1200, 800);
$m->setBackground(0, 0, 0);
/* mouse tracking sprite - empty, but follows mouse so we can
get its x and y coordinates */
$i = $m->add(new SWFSprite());
$i->setName('mouse');
$m->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->add(new SWFAction("
this.quality = 0;
"));
/* morphing box */
$r = new SWFMorph();
$s = $r->getShape1();
/* Note this is backwards from normal shapes. No idea why. */
$s->setLeftFill($s->addFill(0xff, 0xff, 0xff));
$s->movePenTo(-40, -40);
$s->drawLine(80, 0);
$s->drawLine(0, 80);
$s->drawLine(-80, 0);
$s->drawLine(0, -80);
$s = $r->getShape2();
$s->setLeftFill($s->addFill(0x00, 0x00, 0x00));
$s->movePenTo(-1, -1);
$s->drawLine(2, 0);
$s->drawLine(0, 2);
$s->drawLine(-2, 0);
$s->drawLine(0, -2);
/* sprite container for morphing box -
this is just a timeline w/ the box morphing */
$box = new SWFSprite();
$box->add(new SWFAction("
stop();
"));
$i = $box->add($r);
for($n=0; $n<=20; ++$n)
{
$i->setRatio($n/20);
$box->nextFrame();
}
/* this container sprite allows us to use the same action code many times */
$cell = new SWFSprite();
$i = $cell->add($box);
$i->setName('box');
$cell->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->nextFrame();
$cell->add(new SWFAction("
gotoFrame(0);
play();
"));
$cell->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->add($cell);
$i->moveTo(100*$x+50, 100*$y+50);
}
}
$m->nextFrame();
$m->add(new SWFAction("
gotoFrame(1);
play();
"));
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</programlisting>
</example>
</para>
<para>
Same as above, but with nice colored balls...
<example>
<title> <function>swfaction</function> example</title>
<programlisting role="php">
<?php
$m = new SWFMovie();
$m->setDimension(11000, 8000);
$m->setBackground(0x00, 0x00, 0x00);
$m->add(new SWFAction("
this.quality = 0;
/frames.visible = 0;
startDrag('/mouse', 1);
"));
// mouse tracking sprite
$t = new SWFSprite();
$i = $m->add($t);
$i->setName('mouse');
$g = new SWFGradient();
$g->addEntry(0, 0xff, 0xff, 0xff, 0xff);
$g->addEntry(0.1, 0xff, 0xff, 0xff, 0xff);
$g->addEntry(0.5, 0xff, 0xff, 0xff, 0x5f);
$g->addEntry(1.0, 0xff, 0xff, 0xff, 0);
// gradient shape thing
$s = new SWFShape();
$f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
$f->scaleTo(0.03);
$s->setRightFill($f);
$s->movePenTo(-600, -600);
$s->drawLine(1200, 0);
$s->drawLine(0, 1200);
$s->drawLine(-1200, 0);
$s->drawLine(0, -1200);
// need to make this a sprite so we can multColor it
$p = new SWFSprite();
$p->add($s);
$p->nextFrame();
// put the shape in here, each frame a different color
$q = new SWFSprite();
$q->add(new SWFAction("gotoFrame(random(7)+1); stop();"));
$i = $q->add($p);
$i->multColor(1.0, 1.0, 1.0);
$q->nextFrame();
$i->multColor(1.0, 0.5, 0.5);
$q->nextFrame();
$i->multColor(1.0, 0.75, 0.5);
$q->nextFrame();
$i->multColor(1.0, 1.0, 0.5);
$q->nextFrame();
$i->multColor(0.5, 1.0, 0.5);
$q->nextFrame();
$i->multColor(0.5, 0.5, 1.0);
$q->nextFrame();
$i->multColor(1.0, 0.5, 1.0);
$q->nextFrame();
// finally, this one contains the action code
$p = new SWFSprite();
$i = $p->add($q);
$i->setName('frames');
$p->add(new SWFAction("
dx = (/:mousex-/:lastx)/3 + random(10)-5;
dy = (/:mousey-/:lasty)/3;
x = /:mousex;
y = /:mousey;
alpha = 100;
"));
$p->nextFrame();
$p->add(new SWFAction("
this.x = x;
this.y = y;
this.alpha = alpha;
x += dx;
y += dy;
dy += 3;
alpha -= 8;
"));
$p->nextFrame();
$p->add(new SWFAction("prevFrame(); play();"));
$p->nextFrame();
$i = $m->add($p);
$i->setName('frames');
$m->nextFrame();
$m->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->nextFrame();
$m->add(new SWFAction("prevFrame(); play();"));
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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">
<?php
/* sprite has one letter per frame */
$p = new SWFSprite();
$p->add(new SWFAction("stop();"));
$chars = "abcdefghijklmnopqrstuvwxyz".
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
"1234567890!@#$%^&*()_+-=/[]{}|;:,.<> ?`~";
$f = new SWFFont("_sans");
for($n=0; $nremove($i);
$t = new SWFTextField();
$t->setFont($f);
$t->setHeight(240);
$t->setBounds(600,240);
$t->align(SWFTEXTFIELD_ALIGN_CENTER);
$t->addString($c);
$i = $p->add($t);
$p->labelFrame($c);
$p->nextFrame();
}
/* hit region for button - the entire frame */
$s = new SWFShape();
$s->setFillStyle0($s->addSolidFill(0, 0, 0, 0));
$s->drawLine(600, 0);
$s->drawLine(0, 400);
$s->drawLine(-600, 0);
$s->drawLine(0, -400);
/* button checks for pressed key, sends sprite to the right frame */
$b = new SWFButton();
$b->addShape($s, SWFBUTTON_HIT);
for($n=0; $naddAction(new SWFAction("
setTarget('/char');
gotoFrame('$c');
"), SWFBUTTON_KEYPRESS($c));
}
$m = new SWFMovie();
$m->setDimension(600,400);
$i = $m->add($p);
$i->setName('char');
$i->moveTo(0,80);
$m->add($b);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
</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:
-->
--hirokawa986483357--
Attachments:
unknown1
|