高傲的活着 发表于 2011-12-22 08:54

Fade特效之图片切换功能

<DIV><FONT color=#f00000>Fade特效:</FONT></DIV>
<DIV><a href="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201107/12/25434387_1310440645AEs8.jpg" target="_blank"><IMG border=0 src="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201107/12/25434387_1310440645AEs8.jpg" .load="imgResize(this, 650);" ;></A></DIV>
<DIV><FONT color=#f000f0>源码:</FONT></DIV>
<DIV>
<DIV id=codeText class=codeText>
<OL style="PADDING-BOTTOM: 5px; MARGIN: 0px 1px 0px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 5px" class=dp-css>
<LI><SPAN style="COLOR: #000000"><SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">?</SPAN>xml <SPAN style="COLOR: #ff0000">version</SPAN><SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"1.0"</SPAN> <SPAN style="COLOR: #ff0000">encoding</SPAN><SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"utf-8"</SPAN><SPAN style="COLOR: #0000cc">?</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI><SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>Application xmlns<SPAN style="COLOR: #0000cc">:</SPAN>fx<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"http://ns.adobe.com/mxml/2009"</SPAN> <BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns<SPAN style="COLOR: #0000cc">:</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"library://ns.adobe.com/flex/spark"</SPAN> <BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns<SPAN style="COLOR: #0000cc">:</SPAN>mx<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"library://ns.adobe.com/flex/mx"</SPAN> minWidth<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"955"</SPAN> minHeight<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"600"</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>layout<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>BasicLayout<SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>layout<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN>fx<SPAN style="COLOR: #0000cc">:</SPAN>Declarations<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #ff9900">&lt;!-- 将非可视元素(例如服务、值对象)放在此处 --&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">/</SPAN>fx<SPAN style="COLOR: #0000cc">:</SPAN>Declarations<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN>fx<SPAN style="COLOR: #0000cc">:</SPAN><SPAN style="COLOR: #0000ff">Script</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">!</SPAN><SPAN style="COLOR: #0000cc">[</SPAN>CDATA<SPAN style="COLOR: #0000cc">[</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #ff0000">import</SPAN> spark<SPAN style="COLOR: #0000cc">.</SPAN>effects<SPAN style="COLOR: #0000cc">.</SPAN>Fade<SPAN style="COLOR: #0000cc">;</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function showImage<SPAN style="COLOR: #0000cc">(</SPAN><SPAN style="COLOR: #0000cc">)</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>void<SPAN style="COLOR: #0000cc">{</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000ff">var</SPAN> fade<SPAN style="COLOR: #0000cc">:</SPAN>Fade<SPAN style="COLOR: #0000cc">=</SPAN>new Fade<SPAN style="COLOR: #0000cc">(</SPAN><SPAN style="COLOR: #0000cc">)</SPAN><SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fade<SPAN style="COLOR: #0000cc">.</SPAN><SPAN style="COLOR: #ff0000">target</SPAN><SPAN style="COLOR: #0000cc">=</SPAN>myImage<SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fade<SPAN style="COLOR: #0000cc">.</SPAN>alphaFrom<SPAN style="COLOR: #0000cc">=</SPAN>0<SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fade<SPAN style="COLOR: #0000cc">.</SPAN>alphaTo<SPAN style="COLOR: #0000cc">=</SPAN>1<SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fade<SPAN style="COLOR: #0000cc">.</SPAN>play<SPAN style="COLOR: #0000cc">(</SPAN><SPAN style="COLOR: #0000cc">)</SPAN><SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">}</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function hideImage<SPAN style="COLOR: #0000cc">(</SPAN><SPAN style="COLOR: #0000cc">)</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>void<SPAN style="COLOR: #0000cc">{</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000ff">var</SPAN> fade<SPAN style="COLOR: #0000cc">:</SPAN>Fade<SPAN style="COLOR: #0000cc">=</SPAN>new Fade<SPAN style="COLOR: #0000cc">(</SPAN><SPAN style="COLOR: #0000cc">)</SPAN><SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fade<SPAN style="COLOR: #0000cc">.</SPAN><SPAN style="COLOR: #ff0000">target</SPAN><SPAN style="COLOR: #0000cc">=</SPAN>myImage<SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fade<SPAN style="COLOR: #0000cc">.</SPAN>alphaFrom<SPAN style="COLOR: #0000cc">=</SPAN>1<SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fade<SPAN style="COLOR: #0000cc">.</SPAN>alphaTo<SPAN style="COLOR: #0000cc">=</SPAN>0<SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fade<SPAN style="COLOR: #0000cc">.</SPAN>play<SPAN style="COLOR: #0000cc">(</SPAN><SPAN style="COLOR: #0000cc">)</SPAN><SPAN style="COLOR: #0000cc">;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">}</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">]</SPAN><SPAN style="COLOR: #0000cc">]</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">/</SPAN>fx<SPAN style="COLOR: #0000cc">:</SPAN><SPAN style="COLOR: #0000ff">Script</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>VGroup horizontalCenter<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"-405"</SPAN> verticalCenter<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"-240"</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>HGroup<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>BitmapImage <SPAN style="COLOR: #ff0000">id</SPAN><SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"myImage"</SPAN> source<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"@Embed('file:/D:/image/6.jpg')"</SPAN><SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>HGroup<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>HGroup<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN><SPAN style="COLOR: #0000ff">Button</SPAN> <SPAN style="COLOR: #0000ff">label</SPAN><SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"显示图片"</SPAN> click<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"showImage()"</SPAN><SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN><SPAN style="COLOR: #0000ff">Button</SPAN> <SPAN style="COLOR: #0000ff">label</SPAN><SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"隐藏图片"</SPAN> click<SPAN style="COLOR: #0000cc">=</SPAN><SPAN style="COLOR: #ff00ff">"hideImage()"</SPAN><SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>HGroup<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>VGroup<SPAN style="COLOR: #0000cc">&gt;</SPAN><BR></LI>
<LI><SPAN style="COLOR: #0000cc">&lt;</SPAN><SPAN style="COLOR: #0000cc">/</SPAN><SPAN style="COLOR: #0000ff">s</SPAN><SPAN style="COLOR: #0000cc">:</SPAN>Application<SPAN style="COLOR: #0000cc">&gt;</SPAN></SPAN></LI></OL></DIV></DIV>
页: [1]
查看完整版本: Fade特效之图片切换功能