<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >SWFDisplayItem->setRatio()</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="Ming functions for Flash" HREF="ref.ming.html"><LINK REL="PREVIOUS" TITLE="SWFDisplayItem->setName()" HREF="function.swfdisplayitem.setname.html"><LINK REL="NEXT" TITLE="SWFDisplayItem->skewX()" HREF="function.swfdisplayitem.skewx.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.swfdisplayitem.setname.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.swfdisplayitem.skewx.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.swfdisplayitem.setratio" ></A >SWFDisplayItem->setRatio()</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN121205" ></A ><P > (no version information, might be only in CVS)</P >SWFDisplayItem->setRatio() -- Sets the object's ratio</DIV ><DIV CLASS="refsect1" ><A NAME="AEN121208" ></A ><H2 >说明</H2 >class <B CLASS="classname" >SWFDisplayItem</B > { <BR ></BR >void <B CLASS="methodname" >setRatio</B > ( float ratio )<BR ></BR >}<DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >警告</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >本函数是<SPAN CLASS="emphasis" ><I CLASS="emphasis" >实验性</I ></SPAN >的。本函数的行为,包括函数名称以及其它任何关于本函数的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本函数风险自担。</P ></TD ></TR ></TABLE ></DIV ><P > <B CLASS="function" >swfdisplayitem->setratio()</B > sets the object's ratio to <CODE CLASS="parameter" >ratio</CODE >. Obviously only useful for morphs. </P ><P > The object may be a <B CLASS="function" >swfshape()</B >, a <B CLASS="function" >swfbutton()</B >, a <B CLASS="function" >swftext()</B > or a <B CLASS="function" >swfsprite()</B > object. It must have been added using the <B CLASS="function" >swfmovie->add()</B >. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN121231" ></A ><H2 >返回值</H2 ><P > 无返回值。 </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN121234" ></A ><H2 >范例</H2 ><P > This simple example will morph nicely three concentric circles. <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN121237" ></A ><P ><B >例 1. <B CLASS="function" >swfdisplayitem->setname()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /><br />$p </font><font color="#007700">= new </font><font color="#0000BB">SWFMorph</font><font color="#007700">();<br /><br /></font><font color="#0000BB">$g </font><font color="#007700">= new </font><font color="#0000BB">SWFGradient</font><font color="#007700">();<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.16</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.32</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.48</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.64</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.80</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">1.00</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$s </font><font color="#007700">= </font><font color="#0000BB">$p</font><font color="#007700">-></font><font color="#0000BB">getShape1</font><font color="#007700">();<br /></font><font color="#0000BB">$f </font><font color="#007700">= </font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">addFill</font><font color="#007700">(</font><font color="#0000BB">$g</font><font color="#007700">, </font><font color="#0000BB">SWFFILL_RADIAL_GRADIENT</font><font color="#007700">);<br /></font><font color="#0000BB">$f</font><font color="#007700">-></font><font color="#0000BB">scaleTo</font><font color="#007700">(</font><font color="#0000BB">0.05</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">setLeftFill</font><font color="#007700">(</font><font color="#0000BB">$f</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">movePenTo</font><font color="#007700">(-</font><font color="#0000BB">160</font><font color="#007700">, -</font><font color="#0000BB">120</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">drawLine</font><font color="#007700">(</font><font color="#0000BB">320</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">drawLine</font><font color="#007700">(</font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">240</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">drawLine</font><font color="#007700">(-</font><font color="#0000BB">320</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">drawLine</font><font color="#007700">(</font><font color="#0000BB">0</font><font color="#007700">, -</font><font color="#0000BB">240</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$g </font><font color="#007700">= new </font><font color="#0000BB">SWFGradient</font><font color="#007700">();<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.16</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.32</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.48</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.64</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">0.80</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0xff</font><font color="#007700">);<br /></font><font color="#0000BB">$g</font><font color="#007700">-></font><font color="#0000BB">addEntry</font><font color="#007700">(</font><font color="#0000BB">1.00</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$s </font><font color="#007700">= </font><font color="#0000BB">$p</font><font color="#007700">-></font><font color="#0000BB">getShape2</font><font color="#007700">();<br /></font><font color="#0000BB">$f </font><font color="#007700">= </font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">addFill</font><font color="#007700">(</font><font color="#0000BB">$g</font><font color="#007700">, </font><font color="#0000BB">SWFFILL_RADIAL_GRADIENT</font><font color="#007700">);<br /></font><font color="#0000BB">$f</font><font color="#007700">-></font><font color="#0000BB">scaleTo</font><font color="#007700">(</font><font color="#0000BB">0.05</font><font color="#007700">);<br /></font><font color="#0000BB">$f</font><font color="#007700">-></font><font color="#0000BB">skewXTo</font><font color="#007700">(</font><font color="#0000BB">1.0</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">setLeftFill</font><font color="#007700">(</font><font color="#0000BB">$f</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">movePenTo</font><font color="#007700">(-</font><font color="#0000BB">160</font><font color="#007700">, -</font><font color="#0000BB">120</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">drawLine</font><font color="#007700">(</font><font color="#0000BB">320</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">drawLine</font><font color="#007700">(</font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">240</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">drawLine</font><font color="#007700">(-</font><font color="#0000BB">320</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /></font><font color="#0000BB">$s</font><font color="#007700">-></font><font color="#0000BB">drawLine</font><font color="#007700">(</font><font color="#0000BB">0</font><font color="#007700">, -</font><font color="#0000BB">240</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$m </font><font color="#007700">= new </font><font color="#0000BB">SWFMovie</font><font color="#007700">();<br /></font><font color="#0000BB">$m</font><font color="#007700">-></font><font color="#0000BB">setDimension</font><font color="#007700">(</font><font color="#0000BB">320</font><font color="#007700">, </font><font color="#0000BB">240</font><font color="#007700">);<br /></font><font color="#0000BB">$i </font><font color="#007700">= </font><font color="#0000BB">$m</font><font color="#007700">-></font><font color="#0000BB">add</font><font color="#007700">(</font><font color="#0000BB">$p</font><font color="#007700">);<br /></font><font color="#0000BB">$i</font><font color="#007700">-></font><font color="#0000BB">moveTo</font><font color="#007700">(</font><font color="#0000BB">160</font><font color="#007700">, </font><font color="#0000BB">120</font><font color="#007700">);<br /><br />for (</font><font color="#0000BB">$n</font><font color="#007700">=</font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$n</font><font color="#007700"><=</font><font color="#0000BB">1.001</font><font color="#007700">; </font><font color="#0000BB">$n</font><font color="#007700">+=</font><font color="#0000BB">0.01</font><font color="#007700">) {<br /> </font><font color="#0000BB">$i</font><font color="#007700">-></font><font color="#0000BB">setRatio</font><font color="#007700">(</font><font color="#0000BB">$n</font><font color="#007700">);<br /> </font><font color="#0000BB">$m</font><font color="#007700">-></font><font color="#0000BB">nextFrame</font><font color="#007700">();<br />}<br /><br /></font><font color="#0000BB">header</font><font color="#007700">(</font><font color="#DD0000">'Content-type: application/x-shockwave-flash'</font><font color="#007700">);<br /></font><font color="#0000BB">$m</font><font color="#007700">-></font><font color="#0000BB">output</font><font color="#007700">();<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.swfdisplayitem.setname.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.swfdisplayitem.skewx.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >SWFDisplayItem->setName()</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ming.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >SWFDisplayItem->skewX()</TD ></TR ></TABLE ></DIV ></BODY ></HTML >