﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-asfman-文章分类-flash</title><link>http://www.cnitblog.com/asfman/category/6161.html</link><description>有些事，我们明知道是错的，也要去坚持，因为不甘心；有些人，我们明知道是爱的，也要去放弃，因为没结局；有时候，我们明知道没路了，却还在前行，因为习惯了。</description><language>zh-cn</language><lastBuildDate>Mon, 26 Sep 2011 13:39:53 GMT</lastBuildDate><pubDate>Mon, 26 Sep 2011 13:39:53 GMT</pubDate><ttl>60</ttl><item><title>rensea flash widget test 1</title><link>http://www.cnitblog.com/asfman/articles/61445.html</link><dc:creator>汪杰</dc:creator><author>汪杰</author><pubDate>Wed, 16 Sep 2009 16:15:00 GMT</pubDate><guid>http://www.cnitblog.com/asfman/articles/61445.html</guid><wfw:comment>http://www.cnitblog.com/asfman/comments/61445.html</wfw:comment><comments>http://www.cnitblog.com/asfman/articles/61445.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/asfman/comments/commentRss/61445.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/asfman/services/trackbacks/61445.html</trackback:ping><description><![CDATA[package {<br>&nbsp;&nbsp;&nbsp; import com.adobe.serialization.json.JSON;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; import flash.display.Sprite;<br>&nbsp;&nbsp;&nbsp; import flash.events.Event;<br>&nbsp;&nbsp;&nbsp; import flash.net.URLLoader;<br>&nbsp;&nbsp;&nbsp; import flash.net.URLRequest;<br>&nbsp;&nbsp;&nbsp; import flash.text.TextField;<br>&nbsp;&nbsp;&nbsp; import flash.text.TextFormat;<br>&nbsp;&nbsp;&nbsp; [SWF(width="350",height="500")]<br>&nbsp;&nbsp;&nbsp; public class JSONTest extends Sprite<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; public function JSONTest()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var loader:URLLoader = new URLLoader();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; loader.load(new URLRequest("http://rensea.com/statuses/user_timeline/asfman.json?count=20"));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; loader.addEventListener(Event.COMPLETE, decodeJSON);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; private function decodeJSON(event:Event):void{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var oRenseaArr:Array = JSON.decode(event.target.data);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renseaApiParser(oRenseaArr);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; private function renseaApiParser(arr:Array):void{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var oTemp:TextField;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(var i:uint = 0, l:uint = arr.length; i &lt; l; i++){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var oText:TextField = new TextField();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; oText.autoSize = "left";<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; oText.wordWrap = true;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; oText.multiline = true;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; oText.width = 350;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var oFmt:TextFormat = new TextFormat();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; oFmt.size = 12;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oText.appendText(arr[i].text||arr[i].link_title||arr[i].link_desc);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oText.setTextFormat(oFmt);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(oTemp &amp;&amp; oTemp.height) oText.y = oTemp.y + oTemp.height;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; trace(oText.y);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addChild(oText); <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oTemp = oText;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br><br><img src ="http://www.cnitblog.com/asfman/aggbug/61445.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/asfman/" target="_blank">汪杰</a> 2009-09-17 00:15 <a href="http://www.cnitblog.com/asfman/articles/61445.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>flash test</title><link>http://www.cnitblog.com/asfman/articles/58758.html</link><dc:creator>汪杰</dc:creator><author>汪杰</author><pubDate>Mon, 25 May 2009 07:35:00 GMT</pubDate><guid>http://www.cnitblog.com/asfman/articles/58758.html</guid><wfw:comment>http://www.cnitblog.com/asfman/comments/58758.html</wfw:comment><comments>http://www.cnitblog.com/asfman/articles/58758.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/asfman/comments/commentRss/58758.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/asfman/services/trackbacks/58758.html</trackback:ping><description><![CDATA[&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;<br>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br>&lt;head&gt;<br>&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&nbsp; /&gt;<br>&lt;title&gt;&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;embed id="sohuGame" height="366" align="middle" width="550" name="sohuGame" src="http://s2.bai.itc.cn/game-swf/2009/05/08/16/23/1211f51f211_0.swf" quality="high" flashvars="req=pyQfFfllfVnGASA" swliveconnect="true" wmode="Opaque" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/&gt;<br>&lt;script type="text/javascript"&gt;<br>&lt;!--<br>var sohu = {<br>&nbsp;&nbsp; game: {<br>&nbsp;&nbsp;&nbsp;&nbsp; gProcessor : {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; startgame: function(t){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(t);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; endgame: function(t){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; alert(t);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br>}<br>function sohuGame_DoFSCommand(name, args) {<br>&nbsp;&nbsp;&nbsp; var a;<br>&nbsp;&nbsp;&nbsp; if ((a = window.sohu) &amp;&amp; (a = a.game) &amp;&amp; a.gProcessor) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (arguments.callee._commands[name] || function(){})(args);<br>&nbsp;&nbsp;&nbsp; }<br>};<br>sohuGame_DoFSCommand._commands = {<br>&nbsp;&nbsp;&nbsp; startgame: function(value) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sohu.game.gProcessor.startgame();<br>&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp; endgame: function(value) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sohu.game.gProcessor.endgame(eval('(' + value + ')'));<br>&nbsp;&nbsp;&nbsp; }<br>};<br><br>//--&gt;<br>&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br><img src ="http://www.cnitblog.com/asfman/aggbug/58758.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/asfman/" target="_blank">汪杰</a> 2009-05-25 15:35 <a href="http://www.cnitblog.com/asfman/articles/58758.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>FSCommand 用法详解-Flash教程</title><link>http://www.cnitblog.com/asfman/articles/58756.html</link><dc:creator>汪杰</dc:creator><author>汪杰</author><pubDate>Mon, 25 May 2009 06:49:00 GMT</pubDate><guid>http://www.cnitblog.com/asfman/articles/58756.html</guid><wfw:comment>http://www.cnitblog.com/asfman/comments/58756.html</wfw:comment><comments>http://www.cnitblog.com/asfman/articles/58756.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/asfman/comments/commentRss/58756.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/asfman/services/trackbacks/58756.html</trackback:ping><description><![CDATA[<p class="c"><font id="zoom">1、FS Command介绍
</font></p>
<p class="c"><font id="zoom">       　　FS Command命令是Flash系统用来支持其他应用程序互相传达命令的工具，有在Flash播放器和网页两方面用途。先看看它的基本用法：
</font></p>
<p class="c"><font id="zoom">       　　FS Command函数设定有''Command''和''Arguments''两项，在Standalone player播放时适用于以下语句：
</font></p>
<p class="c"><font id="zoom">Command Arguments FS Command <br>Fullscreen true or false 控制是否全屏 <br>Allowscale true or false 右键显示菜单 <br>Exec 应用程序路径 打开应用程序 <br>Quit 不填 关闭动画      <br><br><br><br>
</font></p>
<p class="c"><font id="zoom">       　　注重：与在网页中，全屏播放的方法是不同的！ <br><br><br><br>
</font></p>
<p class="c"><font id="zoom">2、FS Command页面初级用法 <br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　 在网页应用上，FS Command有两大功能。<br>                　　（1）能使Flash向脚本语言发送命令。可以是调用脚本语言中的一段函数或传递变量给脚本语言等。<br>                　　（2）能使脚本语言（js,vbs）向Flash发送命令。可以是给Flash中定义变量或是直接控制Flash动画的时间线上的跳转或给Flash中定义实体的属性等。<br>          　　为了使大家有一个感性的熟悉，先来看这个程序：   <br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　看到了么？它是这样实现的：<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">             　　（1）用Flash作一个简单的按钮，将按钮的Action设为：<br><br><br><br></font></p>
<font id="zoom">On(Release)<br>                               FSCommand("alert","Hello,This is FS Command speaking")<br>                            End On<br>   <br><br>
</font>
<p class="c"><font id="zoom">　　（2）将按钮输出为swf，用Dreamweaver插入网页，并起ID名为"button"<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">                   （3）在网页&lt;head&gt;与&lt;/head&gt;之间加入：<br><br><br><br></font></p>
<font id="zoom">&lt;script language=javascript&gt;<br>                            function button_DoFSCommand(command,args)<br>                            {if(command == "alert"){<br>                            alert("Now look at this:" args);}<br>                            }<br>                            &lt;/script&gt;<br>                            &lt;SCRIPT LANGUAGE=VBScript&gt;<br>                            Sub button_FSCommand(ByVal command, ByVal args)<br>                            call button_DoFSCommand(command, args)<br>                            end sub<br>                            &lt;/SCRIPT&gt;   <br><br>
</font>
<p class="c"><font id="zoom"> 　　 下面对（3）点的语法做一些解释："function
ID_DoFSCommand(command,args)"是引用FS
Command的一个固定格式，ID就是swf插入网页后起的ID名字。"if(command="")句的后面要填的就是FlashAction中
command栏里填写的内容，"args"是个变量，上例中args代表的就是Argument里的内容。"alert"是"JS"函数，作用是输出信
息。看到JS语句后面的一段VBS代码了么？这段代码可是非常重要噢，假如你的浏览器是IE的话，这段代码是必不可少的。<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">3、FS Command之Flash Methods<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　Flash Methods指能运行在脚本中并能于Flash沟通的一组特定函数。<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　在IE中Flash Methods的格式为：ID.FlashMethods<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　我们还是用学习例子的方法来了解Flash Methods的功能和用法吧：   <br><br><br><br>
</font></p>
<p class="c"><font id="zoom">          　　请点击按钮！看到效果了么?它是这样实现的:<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　       （1）在Flash中画一个文本框，定义其实体名为get，并设置文本的属性为Multiline（答应换行），Word wrap（边界换行）。<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　       （2）制作按钮&#8220;提交&#8221;和&#8220;清除&#8221;，分别设置action为：<br><br><br><br></font></p>
<p class="c"><font id="zoom">On(Release)<br>                               FSCommand("post","")<br>                            End On<br>                            On(Release)<br>                               FSCommand("clear","")<br>                            End On<br>   <br>   <br><br><br><br>
</font></p>
<p class="c"><font id="zoom">                　　       （3）用Dreamweaver将导出的swf插入网页，起ID名为buttonn。<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　       （4）网页代码中加入：<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">&lt;script language=javascript&gt;<br>                            function buttonn_DoFSCommand(command,args)<br>                            {if(command == "post")<br>                            buttonn.SetVariable("_root.get","哈哈！神奇吧？这是JavaScript说的话！~0~")<br>                            else if(command == "clear")<br>                            buttonn.SetVariable("_root.get","")<br>                            }<br>                            &lt;/script&gt; <br>                            &lt;SCRIPT LANGUAGE=VBScript&gt;<br>                            Sub buttonn_FSCommand(ByVal command, ByVal args)<br>                            call buttonn_DoFSCommand(command, args)<br>                            end sub<br>                            &lt;/SCRIPT&gt;   <br>   <br>   <br><br></font></p>
<font id="zoom"><br><br>
</font>
<p class="c"><font id="zoom">             4、Flash Methods函数集<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">　　 看了上面的例子，你一定对Flash Methods有所了解了吧！下面我来介绍一下Flash Methods的全部函数：<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">Flash Method函数 函数解释 <br>Play() 播放动画 <br>StopPlay() 停止动画 <br>IsPlaying() 动画是否正在播放(true,false) <br>GotoFrame(frame_number) 跳转到某帧(frame_number 1) <br>TotalFrames() 获取动画总帧数 <br>CurrentFrame() 回传当前动画所在帧数-1 <br>Rewind() 使动画返回第一帧 <br>SetZoomRect(left,top,right,buttom) 放大指定区域 <br>Zoom(percent) 改变动画大小 <br>Pan(x_position,y_position,unit) 使动画在x,y方向上平移 <br>PercentLoaded() 返回动画被载入的百分比(0-100) <br>LoadMovie(level_number,path) 加载动画 <br>TGotoFrame(movie_clip,frame_number) movie_clip跳转到指定帧数 <br>TGotoLabel(muvie_clip,label_name) movie_clip跳转到指定标签 <br>TCurrentFrame(movie_clip) 回传movie_clip当前帧-1 <br>TCurrentLabel(movie_clip) 回传movie_clip当前标签 <br>TPlay(movie_clip) 播放movie_clip <br>TStopPlay(movie_clip) 停止movie_clip的播放 <br>GetVariable(variable_name) 获取变量 <br>SetVariable(variable_name,value) 变量赋值 <br>TCallFrame(movie_clip,frame_number) call指定帧上的action <br>TCallLabel(movie_clip,label) call指定标签上的action <br>TGetProperty(movie_clip,property) 获取movie_clip的指定属性 <br>TSetProperty(movie_clip,property,number) 设置movie_clip的指定属性   <br>   <br><br><br><br>
</font></p>
<p class="c"><font id="zoom">       　　需要说明的是：最后两个函数在获取movie_clip的属性时，是以0到18的数字来表示的。下面列出它们分别代表的意思：<br><br><br><br>
</font></p>
<p class="c"><font id="zoom">属性 作用 数字 使用方式 <br>X Position X坐标 0 Get,Set <br>Y Position Y坐标 1 Get,Set <br>X Scale X方向缩放比率 2 Get,Set <br>Y Scale Y方向缩放比率 3 Get,Set <br>CurrentFrame movie_clip当前所在帧数 4 Get <br>TotalFrames movie_clip总帧数 5 Get <br>Alpha movie_clip的透明度 6 Get,Set <br>Visibility movie_clip是否可见 7 Get,Set <br>Width movie_clip的宽度 8 Get <br>Height movie_clip的高度 9 Get <br>Rotation movie_clip的旋转度 10 Get,Set <br>Target movie_clip的路径 11 Get <br>Framesloaded movie_clip已载入的帧数 12 Get <br>Name movie_clip的实体名字 13 Get,Set <br>DropTarget movie_clip的拖拽 14 Get <br>Url 包含movie_clip的动画的url 15 Get <br>HighQuality 设置画面质量为高质量 16 Get,Set <br>FocusRect 显示按钮边框 17 Get,Set <br>SoundBufTime 预设声音缓冲时间 18 Get,Set   <br>   <br>    　　到此为止，FS Command的全部用法就介绍完了。我们可以看到，FS Command为Flash打开了一个使用脚本语言的接口，这可以弥补Flash在函数上的不足。 所以，利用好这个方法，将使我们在制作Flash动画时如虎添翼！<br></font></p><img src ="http://www.cnitblog.com/asfman/aggbug/58756.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/asfman/" target="_blank">汪杰</a> 2009-05-25 14:49 <a href="http://www.cnitblog.com/asfman/articles/58756.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>图形元件与影片剪辑元件的区别</title><link>http://www.cnitblog.com/asfman/articles/40908.html</link><dc:creator>汪杰</dc:creator><author>汪杰</author><pubDate>Fri, 14 Mar 2008 02:14:00 GMT</pubDate><guid>http://www.cnitblog.com/asfman/articles/40908.html</guid><wfw:comment>http://www.cnitblog.com/asfman/comments/40908.html</wfw:comment><comments>http://www.cnitblog.com/asfman/articles/40908.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/asfman/comments/commentRss/40908.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/asfman/services/trackbacks/40908.html</trackback:ping><description><![CDATA[<div class=xspace-itemmessage id=xspace-showmessage>
<div class=t_msgfont id=postmessage_6234422><br>&lt;1&gt;:<br>&nbsp;&nbsp;从原理上说，这两个是完全没有区别，都可以制作<a onclick="javascript:tagshow(event, '%B6%AF%BB%AD');" href="javascript:;" target=_self><u><strong><font color=#000000>动画</font></strong></u></a>，而且都可以播放。但就具体而言，影片剪辑（一般称为 MC）<br>&nbsp;&nbsp;可以自动播放，而且如果不加动作控制的话会是无限循环播放，但图形却不行，它要求放置图形的位置要有足够多的<br>&nbsp;&nbsp;帧，例如。在图形中定义了一段动画，共计 20 帧，但放置图形的场景中却只有3帧，那么，这个图形元件在主场景<br>&nbsp;&nbsp;中就只会播放3帧。另外，MC可以被脚本直接进行控制，不但MC内部可以定义脚本，它本身也可以命名并被<a onclick="javascript:tagshow(event, '%C6%E4%CB%FC');" href="javascript:;" target=_self><u><strong><font color=#000000>其它</font></strong></u></a>脚本<br>&nbsp;&nbsp;进行控制。这就是它们两者的一些区别。我也只是简单的说说，可能还有一些更深层次的区别没有讲出来。<br>&lt;2&gt;:<br>1:其实剪辑和图象的从内部构造来说。剪辑是有独立的时间线的。也就是说他的播放是不受父级时间先控制的。而图象<br>&nbsp; &nbsp;就是没有独立时间线的。剪辑可以理解是通过loadMovie装载的一个独立影片.<br><br>2:在影片剪辑里做一个动画片段，放到场景里，只要1桢就可以播放而在图形里做好的片段，放进场景则需要和图形里的动画一样的桢数<br><br>3:在这里我看到了一些家伙对这2个的错误理解！<br>&nbsp; &nbsp;影片剪辑是代替不了图形元件的，做动画根本就不用影片剪辑的，缺点太多了，而它的优点对于做动画（不要求编程）<br>&nbsp; &nbsp;的时候是没有用的，还有就是，图形元件可以设置显示第几帧，比如说：你做了个手的图形元件，并且在里面有很多<br>&nbsp; &nbsp;帧，每帧是不同的手的形状，如果是图形元件就可以设置显示那一帧，但是影片剪辑是没这个功能的，还有你的作品<br>&nbsp; &nbsp;如果要装成电视上看的，放再AE等后期处理元件处理要输出PNG序列图的时候，是输出不了的，只会是影片剪辑开始的<br>&nbsp; &nbsp;那个画面....<br>&nbsp; &nbsp;还有在做动画的时候，影是不能随时浏览效果的，因为准确的说，它其实是动画片里的小动画片，在F8面多了很多特<br>&nbsp; &nbsp;效，大家可以灵活运用，我建议调好效果以后再把它添加为图形元件。<br>&lt;3&gt;:<br>&nbsp; &nbsp; 图形元件中的动画在主场景中拖动时间轴是可以预览的，MC不可！ <br>&nbsp; &nbsp; MC中加as可生效，图形中不可！ <br>&nbsp; &nbsp; MC中可加音效！<br>&lt;4&gt;:<br>&nbsp; &nbsp; 图形转换成图符后，在<a onclick="javascript:tagshow(event, 'Flash');" href="javascript:;" target=_self><u><strong><font color=#000000>Flash</font></strong></u></a>动画中就算反复使用其容量也不会增大，那是因为flash是基于矢量的程序。位图的容量<br>&nbsp; &nbsp; 极大，而矢量图是由一个俱的计算式组成，因此所占的容量要小的多。而且如果要进行补间，也必须把图形转换成图符，<br>&nbsp; &nbsp; 在flash动画中最重要的补间功能，就要把图形转换成图符。 <br>&nbsp; &nbsp; 影片片段元件，它用于创建可独立于主影像时间轴播放的可得复使用的动画片段。 <br>&nbsp; &nbsp; 图形元件是基础，影片元件和按扭元件乃至整个动画都是以它为基础做出来的。把Flash动画说成&#8220;元件的美学&#8221;一点都<br>&nbsp; &nbsp; 不夸张。因为用Flash制作的动画质量好坏直接与&#8220;能否很好地运用元件有关&#8221;。&nbsp; &nbsp; 你多做工几个动画就知道了，从简<br>&nbsp; &nbsp; 单的开始。下面的压缩包里有：风车、弹球、跑出去的汽车这几个动画，从新做一遍，把握好动画的时间，好好感受一<br>&nbsp; &nbsp; 下就明白了<br>&lt;5&gt;:<br>&nbsp; &nbsp; 图形和影片剪辑的关系大概像声音流和事件声音的关系.然后,图形是在导出前算好属性值的,而影片剪辑则在播放时才计算<br>&nbsp; &nbsp; 的,所以图形的输出速度比较慢.<br>&lt;6&gt;:影片剪辑元件,按钮元件,图形元件 <br>1. 特点 <br>&nbsp; &nbsp;元件是指在flash中创建且保存在库中的图形,按钮或影片剪辑,可以自始至终在影片或其他影片中重复使用,是flash动画中最基本的元素; <br>&nbsp; &nbsp;影片剪辑元件——可以理解为电影中的**,可以完全独立于主场景时间轴并且可以重复播放. <br>&nbsp; &nbsp;按钮元件——实际上是一个只有4帧的影片剪辑,但它的时间轴不能播放,只是根据鼠标指针的动作做出简单的响应,并转到相应的帧.通过给舞台上的按钮实例添加动作语句而实现flash影片强大的交互性. <br>&nbsp; &nbsp;图形元件——是可以重复使用的静态图像,或连接到主影片时间轴上的可重复播放的动画片段.图形元件与影片的时间轴同步运行. <br>2. 相同点: <br>&nbsp; &nbsp;几种元件的相同点是都可以重复使用,且当需要对重复使用的元素进行修改时,只需编辑元件,而不必对所有该元件的实例一一进行修改,flash会根据修改的内容对所有该元件的实例进行更新. <br>3. 区别及应用中需注意的问题: <br>1)影片剪辑元件,按钮元件和图形元件最主要的差别在于,影片剪辑元件和按钮元件的实例上都可以加入动作语句,图形元件的实例上则不能;&nbsp;影片剪辑里的关键帧上可以加入动作语句,按钮元件和图形元件则不能. <br>2)影片剪辑元件和按钮元件中都可以加入声音,图形元件则不能. <br>3)影片剪辑元件的播放不受场景时间线长度的制约,它有元件自身独立的时间线;按钮元件独特的4帧时间线并不自动播放,而只是响应鼠&nbsp;&nbsp;标事件;图形元件的播放完全受制于场景时间线; <br>4)影片剪辑元件在场景中敲回车测试时看不到实际播放效果,只能在各自的编辑环境中观看效果,而图形元件在场景中即可适时观看,可以&nbsp;&nbsp;实现所见即所得的效果. <br>5)三种元件在舞台上的实例都可以在属性面板中相互改变其行为,也可以相互交换实例. <br>6)影片剪辑中可以勘套另一个影片剪辑,图形元件中也可以勘套另一个图形元件,但是按钮元件中不能勘套另一个按钮元件;三种元件可以&nbsp;&nbsp;相互勘套 Flash作品的播放保护</div>
</div>
<img src ="http://www.cnitblog.com/asfman/aggbug/40908.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/asfman/" target="_blank">汪杰</a> 2008-03-14 10:14 <a href="http://www.cnitblog.com/asfman/articles/40908.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HTML网页中如何向swf传递参数</title><link>http://www.cnitblog.com/asfman/articles/40903.html</link><dc:creator>汪杰</dc:creator><author>汪杰</author><pubDate>Fri, 14 Mar 2008 01:35:00 GMT</pubDate><guid>http://www.cnitblog.com/asfman/articles/40903.html</guid><wfw:comment>http://www.cnitblog.com/asfman/comments/40903.html</wfw:comment><comments>http://www.cnitblog.com/asfman/articles/40903.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/asfman/comments/commentRss/40903.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/asfman/services/trackbacks/40903.html</trackback:ping><description><![CDATA[<div class=cnt>
<p>本<a onclick="javascript:tagshow(event, '%BD%CC%B3%CC');" href="javascript:;" target=_self><u><strong><font color=#0000ff>教程</font></strong></u></a>主要介绍HTML网页如何取得形如test.html?foo=mytest的foo参数，以及在HTML网页中如何向swf传递参数。<br><br>一、在HTML网页中使用js获取参数。<br>我们知道HTML页面是在客户端执行的，这样要获取参数必须使用客户端脚本（如Javascript），在这点上不同于服务器端脚本获取参数方式。<br>下面的这段js代码获取HTML网页形如"test.html?foo=mytest&amp;program=flash" "?"后所有参数。</p>
<pre>&lt;script language=javascript&gt;<br>&lt;!--<br>var hrefstr,pos,parastr;<br>hrefstr = window.location.href;<br>pos = hrefstr.indexOf("?");<br>parastr = hrefstr.substring(pos+1);<br>if (pos&gt;0){<br> document.write("所有参数："+parastr);<br>} else {<br> document.write("无参数");<br>}<br>//--&gt;<br>&lt;/script&gt;</pre>
<p><br><br>下面的这段js代码则可以更加细化获取HTML网页某一参数</p>
<pre>&lt;script language=javascript&gt;<br>&lt;!--<br>function getparastr(strname) {<br> var hrefstr,pos,parastr,para,tempstr;<br> hrefstr = window.location.href;<br> pos = hrefstr.indexOf("?")<br> parastr = hrefstr.substring(pos+1);<br><br> para = parastr.split("&amp;");<br> tempstr="";<br> for(i=0;i&lt;para.length;i++)<br> {<br>  tempstr = para[i];<br>  pos = tempstr.indexOf("=");<br>  if(tempstr.substring(0,pos) == strname) {<br>   return tempstr.substring(pos+1);<br>  }<br> }<br> return null;<br>}<br>// 获取program参数<br>var programstr = getparastr("program");<br>document.write(programstr);<br>//--&gt;<br>&lt;/script&gt;</pre>
<p><br><br>二、在HTML网页中向swf传递参数。<br>方法一：在网页中使用js，SetVariable设置flashobject中的变量，代码如：</p>
<pre>// "HtmlToSwf"为网页中的flashobject ID<br>HtmlToSwf.SetVariable("_root.info_str","Happy Newyear");</pre>
<p><br>方法二：路径参数，如test.swf?foo=happy2005<br>方法三：使用FlashVars，以下主要介绍FlashVars的用法。使用FlashVars后嵌入HTML的flashobject代码如下：</p>
<pre>&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="550" height="400" id="FlashVars" align="middle"&gt;<br>&lt;param name="allowscriptAccess" value="sameDomain" /&gt;<br>&lt;param name="movie" value="FlashVars.swf" /&gt;<br>&lt;param name="FlashVars" value="foo=happy2005&amp;program=flash&amp;language=简体中文-中国" /&gt;<br>&lt;param name="quality" value="high" /&gt;<br>&lt;param name="bgcolor" value="#ffffff" /&gt;<br>&lt;embed src="FlashVars.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="FlashVars" align="middle" allowscriptAccess="sameDomain" FlashVars="foo=happy2005&amp;program=flash&amp;language=简体中文-中国" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /&gt;</pre>
<p><br><br>通过上面的代码，在SWF(FlashVars.swf)中就可以直接获取foo、program、language变量数据。FlashVars.fla获取FlashVars参数的代码如下：</p>
<pre>// 创建三个文本字段<br>_root.createTextField("foo_txt",1,0,0,16,16);<br>_root.createTextField("program_txt",2,0,32,16,16);<br>_root.createTextField("language_txt",3,0,64,16,16);<br>foo_txt.autoSize = true;<br>foo_txt.border = true;<br>program_txt.autoSize = true;<br>program_txt.border = true;<br>language_txt.autoSize = true;<br>language_txt.border = true;<br>// 获取FlashVars变量<br>foo_txt.text = "HTML中的foo参数："+foo;<br>program_txt.text = "HTML中的program参数："+program;<br>language_txt.text = "HTML中的language参数："+language;</pre>
<p><br><br>三、两者的有效结合。<br>在HTML网页中使用js获取参数，然后将获取的参数作为FlashVars写入flashobject传递给swf。代码如下：</p>
<pre>&lt;script language=javascript&gt;<br>&lt;!--<br>function writeflashobject(parastr) {<br> document.write("&lt;object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"550\" height=\"400\" id=\"FlashVars\" align=\"middle\"\&gt;\n");<br> document.write("&lt;param name=\"allowscriptAccess\" value=\"sameDomain\" /\&gt;\n");<br> document.write("&lt;param name=\"movie\" value=\"FlashVars.swf\" /\&gt;\n");<br> document.write("&lt;param name=\"FlashVars\" value=\""+ parastr +"\" /\&gt;\n");<br> document.write("&lt;param name=\"quality\" value=\"high\" /\&gt;\n");<br> document.write("&lt;param name=\"bgcolor\" value=\"#ffffff\" /\&gt;\n");<br> document.write("&lt;embed src=\"FlashVars.swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\"550\" height=\"400\" name=\"FlashVars\" align=\"middle\" allowscriptAccess=\"sameDomain\" FlashVars=\""+ parastr +"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /\&gt;");<br> document.write("&lt;/object\&gt;");<br>}<br>function getparastr() {<br> var hrefstr,pos,parastr,para,tempstr1;<br> hrefstr = window.location.href;<br> pos = hrefstr.indexOf("?")<br> parastr = hrefstr.substring(pos+1);<br> return parastr;<br>}<br>var parastr = getparastr();<br>writeflashobject(parastr);<br>//--&gt;<br>&lt;/script&gt;</pre>
</div>
<img src ="http://www.cnitblog.com/asfman/aggbug/40903.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/asfman/" target="_blank">汪杰</a> 2008-03-14 09:35 <a href="http://www.cnitblog.com/asfman/articles/40903.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>flash与后台通信（ASP）的几种方法</title><link>http://www.cnitblog.com/asfman/articles/33516.html</link><dc:creator>汪杰</dc:creator><author>汪杰</author><pubDate>Mon, 17 Sep 2007 02:02:00 GMT</pubDate><guid>http://www.cnitblog.com/asfman/articles/33516.html</guid><wfw:comment>http://www.cnitblog.com/asfman/comments/33516.html</wfw:comment><comments>http://www.cnitblog.com/asfman/articles/33516.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/asfman/comments/commentRss/33516.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/asfman/services/trackbacks/33516.html</trackback:ping><description><![CDATA[一、使用loadVariables<br>一个例子简单的描述了如何通过GET方法向<nobr><strong class=kgb onmouseover='isShowAds = true;isShowAds2 = true;KeyGate_ads.Move(this,"","%u5FAE%u8F6F%u670D%u52A1%u5668%u7AEF%u4EA7%u54C1%u5927%u5168%uFF0C%u70B9%u51FB%u83B7%u5F97%u3002","20854","服务器","%u670D%u52A1%u5668","http%3A//go.microsoft.com/%3Flinkid%3D6331218", event)' style="FONT-WEIGHT: normal; CURSOR: hand; COLOR: #0000ff; TEXT-DECORATION: underline" onclick='javascript:window.open("http://s5.17luntan.com/ClickPortal/WebClick.aspx?id=20854&amp;k=%u670D%u52A1%u5668&amp;siteid=10UgtSXQZVAVANBQBRUAAPX1cBVQlSWwYFBFVSVQhRUlM&amp;url=http%3A//flashas.net/bbs/read.php%3Ftid%3D125%26fpage%3D0%26toread%3D%26page%3D1&amp;gourl=http%3A//go.microsoft.com/%3Flinkid%3D6331218&amp;parm=8B43197932E6E63F79E725250AD44EA9BB7AF1EA59AA81CD&amp;alliedsiteid=11232");' onmouseout="isShowAds = false;isShowAds2 = false">服务器</strong></nobr>端的ASP发送请求:<br><br><br><br>_root. pushAction = function(URL,) {<br>this.loadVariables(URL, "GET");<br>}<br>var ask = true;<br>var pushURL = &#8221;<a href="http://localhost/test/return.asp?ask=" target=_blank><font color=#2f5fa1>http://localhost/test/return.asp?ask=</font></a>&#8221;+ ask;<br>pushAction (pushURL);<br>_root.onEnterFrame = fuction(){<br>trace(_root.output);<br>}<br><br>这里首先定义了一个名为pushAction的函数，在loadVariables函数中使用了GET参数。然后定义了一个名为ask的布尔型变量，用来向服务器传递变量。最后使用pushAction函数向服务器上的一个名为return的ASP页面发送GET请求。如果需要对这样的请求作出处理，在ASP中，URL行的分析结果存在于Request对象中，比如下例：<br>return.asp<br><br><br><br>&lt;%@ Language="JScript" %&gt;<br>&lt;%<br>//声明并定义接受请求的变量<br>var str_getask= Request.QueryString("ask"); <br>//声明并定义返回信息变量<br>var str_Msg = "Sorry! Your request tread awry.";<br>//如果接受到的变量为true，则返回成功消息<br>if (str_getask == "true"){<br>str_Msg = "OK! Your request succeed!";<br>}<br>Response.write("output=" + str_Msg);<br>%&gt;<br><br>这样，一个名字为output，值为str_Msg的变量就发送回Flash Player中，可以在flash中以output的名字引用这个变量。当然我们必须注意服务器在处理这个过程中是需要时间的，因此最后那个onEnterFrame用来测试是否有变量返回.<br>二、使用LoadVars<br>loadVariables提供了一种简单的方法让我们可以从服务器端的ASP或者PHP页面载入变量，除了使用GET方法，它还可以使用POST方法将客户端提交的数据传递给服务器。然而在处理大量客户端与服务器端交互的信息时，使用过多的loadVariables语句会让整个程序的维护性和可读性变得复杂。在Flash MX的Action中，新增加了一个LoadVars的对象，并将它和XML，XMLSocket对象一起归纳于Client/Server对象之下。LoadVars 对象是 loadVariables 动作的替代方法，它能够提供一种更好的结构向服务器发送和返回信息。一个典型的LoadVars对象使用的例子如下：<br><br><br><br>//构造一个新的LoadVars对象<br>myload = new LoadVars();<br>//设定myload的动作，以便服务器验证<br>myload.action = "post";<br>//验证和服务器连接的函数<br>myload.onLoad = function(success) {<br>//如果和服务器成功连接则&#8230;<br>if (success) {<br>//如果验证动作成功则&#8230;<br>if (this.conn == "1") {<br>//将返回对象中的output变量赋值给场景中var为output的Dynamic Text框<br>_root.output = this.output;<br>}<br>} else {<br>//如果和服务器连接不成功则返回失败消息，需要检查路径是否正确<br>_root.output = "Can't connect to Server";<br>}<br>};<br>//Dynamic Text的初始值为一个等待消息<br>_root.output = "Waiting for response...";<br>//将myload下的变量发送到服务器端，并将服务器返回的数据结果放在myload对象中<br>myload.sendAndLoad("<a href="http://localhost/test/return.asp" target=_blank><font color=#2f5fa1>http://localhost/test/return.asp</font></a>", myload, "post");<br>//myload.sendAndLoad("<a href="http://localhost:8001/test/return.php" target=_blank><font color=#2f5fa1>http://localhost:8001/test/return.php</font></a>",myload, "post");<br><br>在场景中以一个var名为output的Dynamic Text框来接受来自服务器的消息。使用LoadVars，我们可以利用sendAndLoad方法将一个LoadVars的实体下的所有变量发送出去，并将服务器返回的数据结果存储到一个目标对象中，其中conn，output都是从服务器发送回来的，我们还利用了其onLoad事件函数来检验其是否将信息发送到了服务器页面，再利用从服务器传回来的数据(this.conn)来验证信息是否正确。服务器页面的代码如下：<br>ASP return.asp：<br><br><br><br>&lt;%@ Language="JScript" %&gt;<br>&lt;%<br>var str_Msg;<br>var action;<br>var conn;<br>action = Request.Form("action");<br>if (action == "post"){<br>str_Msg = "OK! return a Msg to you!";<br>conn = 1;<br>}<br>Response.write("conn=" + conn + "&amp;output=" + str_Msg);<br>%&gt;<br><br>PHP return.php:<br><br><br><br>&lt;?php<br>$action = $HTTP_POST_VARS["action"];<br>if ($action == "post") {<br>$str_Msg = "OK! return a Msg to you!";<br>$conn = 1;<br>}<br>echo "conn=" . $conn . "&amp;output=" . $str_Msg;<br>?&gt;<br><br>如果本例执行成功，则会在Flash Player中出现成功画面，如图所示。如果失败，则返回失败消息（一般都是路径出错）
<img src ="http://www.cnitblog.com/asfman/aggbug/33516.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/asfman/" target="_blank">汪杰</a> 2007-09-17 10:02 <a href="http://www.cnitblog.com/asfman/articles/33516.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>