<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[STARWISH  星愿]]></title> 
<link>http://www.starwish.com.cn/index.php</link> 
<description><![CDATA[flash互动,web设计]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[STARWISH  星愿]]></copyright>
<item>
<link>http://www.starwish.com.cn/read.php?223</link>
<title><![CDATA[一个简单的程序来了解PHP]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[PHP 相关]]></category>
<pubDate>Mon, 19 May 2008 08:27:00 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?223</guid> 
<description>
<![CDATA[ 
	一个简单的程序来了解PHP<br/><br/>　　PHP站点的在线教程已经很棒了。而本文的该部分将让你对PHP熟悉一点。我不可能做到没有任何遗漏，我的目的只在于能让你迅速开始你的PHP编程。 <br/><br/>3.1 首要条件<br/><br/>　　你首先必须要有一个正在工作着的支持PHP的web服务器。我假定在你的服务器上所有PHP文件的扩展名为.php3。<br/><br/><br/>3.2 PHP的安装<br/><br/>　　有关PHP的安装配置，可以查阅网页陶吧上的“PHP安装全攻略”专题文章。<br/><br/>3.3 语法<br/><br/>　　从语法上看，PHP语言近似于C语言。可以说，PHP是借鉴C语言的语法特征，由C语言改进而来的。我们可以混合编写PHP代码和HTML代码，不仅可以将PHP脚本嵌入到 HTML 文件中，我们甚至还可以把 HTML 标签也嵌入在 PHP 脚本里。以下是你可以采用的几种方法。你可以选用其中一种你最适合的并且就这样坚持这种方法！<br/><br/>从HTML中分离<br/><br/>以下是可以使用的方法：<br/><? . . . ?><br/><?php . . . ?><br/><script language="php"> . . . </script><br/><% . . . %><br/><br/>　　注：当你使用“<? . . . ?>”将PHP代码嵌入于HTML文件中时，可能会同XML发生冲突，同时，能否使用这一缩减形式还取决于PHP本身的设置。为了可适应XML和其它编辑器，你可以在开始的问号后面加上“php”使PHP代码适应于XML分析器。如：?lt;?php. . . ?>”。也可以像写其它脚本语言那样使用脚本标记，如：“<script language="php"> . . . </script>”。<br/><br/><br/>语句<br/><br/>与Perl和C一样，在PHP中用“；”来分隔语句。那些从HTML中分离出来的标志也表示语句的结束。<br/><br/>注释<br/><br/>PHP支持C，C++和Unix风格的注释方式： <br/><br/>/* C,C++风格多行注释 */ <br/>// C++风格单行注释 <br/># Unix风格单行注释 <br/><br/>echo 和 print<br/><br/>　　PHP 和 HTML 最简单的交互是通过 print 和 echo 语句来实现的，在实际使用中， print 和 echo 两者的功能几乎是完全一样。可以这么说，凡是有一个可以使用的地方，另一个也可以使用。但是，两者之间也还是一个非常重要的区别：在 echo 函数中，可以同时输出多个字符串，而在 print 函数中则只可以同时输出一个字符串。同时，echo函数并不需要圆括号，所以echo函数更像是语句而不像是函数。让我们来看看下面这一实例：<br/><br/><?<br/>$a="hello";<br/>$b="world";<br/>echo "a","b";<br/>print "a","b";<br/>?><br/><br/>用浏览器观看这段代码的运行情况后，你会看到这样的运行结果：<br/>aba<br/>Parse error: parse error in d:adminmyphphometest.php3 on line 5<br/>这说明这段代码并不能完全通过解释，发生错误的地方就在代码的第五行：“print "a","b";”。<br/><br/>3.4一个简单的实例<br/><br/>　　通过我们已经学过的知识，你可以编写一个最简单的程序输出一个也许是程序世界中最有名的词语<br/><HTML><br/><HEAD><br/><TITLE><br/><?<br/>echo "Hello World!";<br/>?><br/></TITLE><br/></HEAD><br/><BODY><br/><H1><br/>First PHP page<br/></H1><br/><HR><br/><?<br/>// Single line C++ style comment<br/>/*<br/>printing the message<br/>*/<br/>echo "Hello World!";<br/># Unix style single line comment<br/>?><br/></BODY><br/></HTML> <br/>
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?222</link>
<title><![CDATA[关于PHP]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[PHP 相关]]></category>
<pubDate>Mon, 19 May 2008 08:25:37 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?222</guid> 
<description>
<![CDATA[ 
	关于PHP<br/>PHP 是秉承Linux 的GNU 风格，借助与源码公开，使他迅速成为世界上目前应用最为广泛的站点制作语言之一。借助与C++的形式，引用类的概念，使得代码的可重复性应用便的异常简单。加上他和Linux,Apache 和MySql 的紧密配合，关键性的应用也没有问题（有名的Sina就 是采用Php）。同时，PHP第四代Zend(PHP4)的核心引擎正式版也已经发布了，整个程序的核心得到了大幅度的改进，让PHP程序的执行速度变得更快。PHP<br/><br/>在最佳化之后的效率，已比传统CGI或者ASP等程序有了更好的表现。而且正因为PHP是免费的，因此任何人都可以访问PHP WEB站点，下载完整的源代码。更重要的是：用PHP编写的代码执行起来会更快，能实现同样功能的PHP代码，不用改变就可以在不同的WEB服务器上、不同的操作系统下运行。就凭这一点，你就已经有足够的理由选择PHP。
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?221</link>
<title><![CDATA[a.swf与加载的swf的通讯方法]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[FLASH学习]]></category>
<pubDate>Wed, 07 May 2008 16:32:12 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?221</guid> 
<description>
<![CDATA[ 
	a.swf与加载的swf的通讯方法(as3.0) <br/>来源：ASFox(nee)<br/>//===== =====================================<br/>a.swf加载b.swf, 在b.swf中使用a.swf的方法和属性。<br/>在a.swf的文档类中：<br/><br/>... ...<br/>var $ldr : Loader=new Loader();<br/> &nbsp; &nbsp; $ldr.contentLoaderInfo.addEventListener(Event.INIT, __loadedShell); <br/> &nbsp; &nbsp; $ldr.load(new URLRequest("b.swf")); <br/><br/>private function __loadedSWF(e : Event) : void {<br/> &nbsp; &nbsp;this.addChild(e.target["content"]);<br/> &nbsp; &nbsp;e.target["content"].getParent(this);//通过b.swf的文档类里的getParent方法将this引用传递到b.swf。<br/> &nbsp;}<br/>... ...<br/>在b.swf文档类中：<br/><br/>private var __parent:Object;<br/>... ...<br/>public function getParent(_parent:Object) : void {<br/> &nbsp; __parent=_parent;//通过__parent 就可以使用a.swf的文档类里的方法和属性了。<br/>}<br/>//===== =====================================<br/>a.swf加载b.swf, 在a.swf中使用b.swf的方法和属性。<br/>在a.swf的文档类中：<br/><br/>private var b_swf:MovieClip;<br/>... ...<br/>var $ldr : Loader=new Loader();<br/> &nbsp; &nbsp; $ldr.contentLoaderInfo.addEventListener(Event.INIT, __loadedShell); <br/> &nbsp; &nbsp; $ldr.load(new URLRequest("b.swf")); <br/><br/>private function __loadedSWF(e : Event) : void {<br/> &nbsp; &nbsp;this.addChild(e.target["content"]);<br/> &nbsp; &nbsp;b_swf=e.target["content"];//通过b_swf来访问b.swf文档类里的方法和属性；<br/> &nbsp;}<br/><br/>版权声明：转载时请以超链接形式标明文章原始出处和作者信息及本声明<br/>http://asfox.blogbus.com/logs/19614543.html<br/>
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?220</link>
<title><![CDATA[AS3加载机制]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[FLASH学习]]></category>
<pubDate>Wed, 07 May 2008 16:01:14 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?220</guid> 
<description>
<![CDATA[ 
	AS3加载机制(转)<br/>AS3加载机制<br/>原文地址:http://hi.baidu.com/ouyang80/blo ... abb70dc83d6d27.html<br/><br/>摸了好一阵子,才弄明白AS3.0的加载机制.<br/>还是坚持自己的原则,从适用的角度做记录!下面分别讲述AS3各加载事件与类!<br/>AS3Loader.rar]相关例子下载(内带swf与jpg加载例子及舞台加载条和CS3的加载条应用类)<br/><br/>带swf预览<br/>一: Loader类<br/>在AS3.0里把所有事件,属性,加载等都集中在某个对象上了.且加载对象与各触发事件也进行了分工,这和2.0时期,用onEnterFrame和不断检测加载百分比强多了!<br/>Loader继承了基类DisplayObjectContainer,所以他可以也必须当作一个对象用addChild添加才能工作.<br/>Loader 类可用于加载 SWF 文件或图像（JPG、PNG 或 静态GIF）文件。 使用 load() 方法来启动加载。 被加载的显示对象将作为 Loader 对象的子级添加。<br/>例:<br/> &nbsp; &nbsp; &nbsp; var loadimg: Loader = new Loader();<br/> &nbsp; &nbsp; &nbsp; var url:String = "http://www.shch8.com/v2007/up/UploadFile/200769182617-1.gif"<br/> &nbsp; &nbsp; &nbsp; var urlReq:URLRequest = new URLRequest();<br/> &nbsp; &nbsp; &nbsp; urlReq.url=url;<br/> &nbsp; &nbsp; &nbsp; loadimg.load(urlReq);<br/> &nbsp; &nbsp; &nbsp; addChild(loadimg);<br/>和2.0 和比,还有一点区别,这里加载时要先把字符串地址转化为url加载对象,在程序中的第三行是直接设置加载对象的url属性的,也可以这样写urlReq = new URLRequest(url),除了url属性还有几个公共属性，一般很少用到如：method用来控制get还是post提交方式。<br/>因为把加载当作一个对象了,所以就不需要象2.0时期一样,新建一个影片来装载加对的物体loadMovie(“myimg.jpg”,”mv”)，我们可以直接设置他的x/y轴或宽高。还有Loader对象是二进制方式加载swf了，在flash9之前我们做加载条是用影片的getBytesLoaded 和getBytesTotal来检测的是否加载完成。这不是真正意义上的加载，只是判断帧的加载数，所以会出现类似情况，加载到20%停了很久突然跳到 90%因为那一帧放了整个影片70%的数据。以前在蓝色里有讨论过这个话题，还有人说是MM在走江湖！呵，现在解决了！<br/>Loader的所有方法：<br/>1. Loader()<br/>创建一个可用于加载文件（如 SWF、JPEG、GIF 或 PNG 文件）的 Loader 对象。<br/>2. close(): void<br/>取消当前正在对 Loader 实例执行的 load() 方法操作。<br/>3.load(request: URLRequest, context: LoaderContext = null):void<br/>将 SWF、JPEG、渐进式 JPEG、非动画 GIF 或 PNG 文件加载到此 Loader 对象的子对象中。<br/>4.loadBytes(bytes:ByteArray, context: LoaderContext = null):void<br/>从 ByteArray 对象中所存储的二进制数据中加载。<br/>5.unload():void<br/>删除此 Loader 对象中使用 load() 方法加载的子项。<br/>二: LoaderInfo事件机制<br/>LoaderInfo非常好用，他是继承EventDispatcher对象用来检测网络加载状态。可以把加载动作细细地解剖出来。<br/>原来在flash9之前，我们绞尽脑汁去获取加载来的swf的宽度、高度、帧频、版本等数据，但一直没研究出好的方法现在LoaderInfo可以做到能获取加载对象的各属性，这点很好有时用swf来加载不确定swf时很有用，可以用那些属性来重新设置主swf。<br/>加载对象所加载数据的实时检测上，PROGRESS事件可以取代以前用onEnterFrame的疯狂检测工作。当然2.0的也有自己的事件，只是很少人用！<br/>LoaderInfo所继承的所有事件：<br/>1.complete(事件参数Event. COMPLETE)<br/>成功加载数据后调度。 <br/>2.HttpStatus(事件参数HTTPStatusEvent.HTTP_STATUS)<br/>在通过 HTTP 发出网络请求并且 Flash Player 可以检测到 HTTP 状态代码时调度。 <br/>3. Init(事件参数Event.INIT)<br/>已加载的 SWF 文件的属性和方法可访问时调度。 <br/>4.IoError(事件参数IOErrorEvent.IO_ERROR)<br/>在发生导致加载操作失败的输入或输出错误时调度。 <br/>5.Open(事件参数Event.OPEN)<br/>在加载操作开始时调度。 <br/><br/>6.Progress(事件参数ProgressEvent.PROGRESS)<br/>在下载操作过程中收到数据时调度。 <br/>7.Unload(事件参数Event.UNLOAD)<br/>每次使用 Loader 对象的 unload() 方法删除已加载对象时，或者当同一 Loader 对象执行第二次加载并且在加载开始之前删除了原始内容时，由 对象调度。<br/>具体测试例子请看loadjpg.swf与loadswf.swf<br/>LoaderInfo的获取swf属性时要等swf加载完才能获取，也就是在COMPLETE事件里获取<br/> &nbsp; &nbsp;如: loadswf.contentLoaderInfo.addEventListener(Event.COMPLETE, loadcom)<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;function loadcom(the:Event):void {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("AS版本:AS"+the.target.actionScriptVersion+".0")<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("swf版本:flash"+the.target.swfVersion+".0")<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("swf宽:"+the.target.width+"swf高:"+the.target.height)<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("swf帧频:"+the.target.frameRate+"帧/秒")<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br/>事件触发的各个顺序分别是<br/>OPEN>>INIT>>HTTP>> COMPLETE<br/>加载操作开始时调度>>进入事件 SWF 文件的属性和方法调度>>状态事件通过 HTTP 发出网络请求并且 Flash Player检测到 HTTP 状态代码>>加载完成<br/>例(需要flashPlay9.0播放器才能正常测试):<br/>三：跨域加载的安全机制<br/>你可以加载来自任何可访问源的内容。<br/>如果执行调用的 SWF 文件位于网络沙箱中并且要加载的文件是本地的，则不允许加载。<br/>如果加载的内容为用 ActionScript 3.0 编写的 SWF 文件，那么除非可以通过调用加载的内容文件中的 System.allowDomain() 或 System.allowInsecureDomain() 方法来允许跨脚本排列，否则另一个安全沙箱中的 SWF 文件不能对它执行跨脚本操作。<br/>如果被加载的内容为 AVM1 SWF 文件（用 ActionScript 1.0 或 2.0 编写），则 AVM2 SWF 文件（用 ActionScript 3.0 编写）不能对它执行跨脚本操作。 但是，可以通过使用 LocalConnection 类在两个 SWF 文件之间实现通信。<br/>如果被加载的内容为图像，则除非该 SWF 文件的域包含在该图像原始域的跨域策略文件中，否则安全沙箱之外的 SWF 文件无法访问其数据。<br/>在只能与本地文件系统的内容交互的沙箱中的影片剪辑不能对只能与远程内容交互的沙箱中的影片剪辑使用脚本，反之亦然。<br/>四：主场景加载条制作<br/>我们都知道，AS2.0是用_root. getBytesLoaded()和_root. getBytesTotal()来判断swf是否被加载完，但在3.0里面_root，_global，_parent等原来的”骨干职工”都被开除了！取代他的是stage，对于场影设置，他是一手遮天了如设置swf全屏，对齐方式，显视品质等。但stage只继承了 DisplayObjectContainer一部分属性，可用的还太少了。<br/>在做场影加载条时，我们要获取场影的加载情况。要想办法把上面讲的 LoadInfo事件添加到主场景去，用stage是做不到的。但可以用显视类DisplayObject 添加，他继承了 EventDispatcher，可以直接用他的属性指定主场景来添加，DisplayObject和属性和原来的movieClip还是很像的，只是前面不用加下划线作区分了如：root.loaderInfo.addEventListener()<br/>用root调度loaderInfo：<br/> &nbsp; &nbsp;root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadshow)<br/> &nbsp; &nbsp; &nbsp;function loadshow(the: ProgressEvent):void {<br/> &nbsp; &nbsp; &nbsp; &nbsp; var loadnum:Number=int(the.bytesLoaded/the.bytesTotal*100);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showtxt.text="load:"+loadnum + "%";<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gotoAndStop(loadnum);<br/> &nbsp; &nbsp; }<br/>
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?219</link>
<title><![CDATA[加载条组件的加载类]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[FLASH学习]]></category>
<pubDate>Wed, 07 May 2008 16:00:17 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?219</guid> 
<description>
<![CDATA[ 
	加载条组件的加载类<br/>只看该作者<br/>package myAs{<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;import fl.containers.UILoader;//图片加载组件<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import fl.controls.Label;//文本组件<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import fl.controls.ProgressBar;//进度条<br/><br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import flash.events.Event;//输入事件类,如果代码写在帧上,可不用输入<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import flash.events.ProgressEvent;//输入事, 件类<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import flash.text.TextField;//引进文本类<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import flash.net.URLRequest; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import fl.controls.ProgressBarMode;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import flash.display.Sprite;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import flash.text.TextFieldAutoSize;//调整类<br/> &nbsp; &nbsp; public class loadimg extends Sprite {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private var url:String = "XXX.jpg"<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private var loadbox: ProgressBar = new ProgressBar();<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private var imgbox: UILoader = new UILoader();<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private var showtxt: Label = new Label();<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private var titleTxt:TextField=new TextField();<br/>//注意:上面的几个对象要声明在这里,不能放在主函数里声明,这样loadeven()等事件函数里才能认到<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public function loadimg() {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;titleTxt.htmlText="图片加载示例:";<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addChild(titleTxt);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;titleTxt.x=0;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;titleTxt.y=10;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showtxt.autoSize = TextFieldAutoSize.LEFT;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showtxt.text = "";<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showtxt.move(150, 10);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addChild(showtxt);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;loadbox.mode = ProgressBarMode.MANUAL;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;loadbox.move(150, 30);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addChild(loadbox);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;imgbox.load(new URLRequest(url));<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;imgbox.addEventListener(ProgressEvent.PROGRESS, loadeven);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;imgbox.addEventListener(Event.COMPLETE, loadend);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;imgbox.setSize(550,400);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;imgbox.move(0, 40);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addChild(imgbox);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private function loadeven(event: ProgressEvent):void {//事件:加载进度显视<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var uiLdr:UILoader = event.currentTarget as UILoader;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var kbLoaded:String = Number(uiLdr.bytesLoaded / 1024).toFixed(1);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var kbTotal:String = Number(uiLdr.bytesTotal / 1024).toFixed(1);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;showtxt.text = kbLoaded + "/" + kbTotal + " KB" + " (load:" + Math.round(uiLdr.percentLoaded) + "%)";<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;loadbox.setProgress(event.bytesLoaded, event.bytesTotal);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private function loadend(event: Event):void {//事件:加载完成 删除事件<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//showtxt.visible = false;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//loadbox.visible = false;//加载完成后隐藏进度条<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;imgbox.removeEventListener(ProgressEvent.PROGRESS, loadeven);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imgbox.removeEventListener(Event.COMPLETE, loadend);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br/> &nbsp; &nbsp; &nbsp;}<br/>使用组件就轻松多了,不用考虑那么多。只是开发出一个适用的产品最好不要去用官方的组件。自己去写过，写过适合自己的组件。不过CS3的Uiloader感觉很不错！<br/>
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?217</link>
<title><![CDATA[一个贴图类]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[FLASH学习]]></category>
<pubDate>Fri, 18 Apr 2008 04:23:38 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?217</guid> 
<description>
<![CDATA[ 
	一个贴图类,文档资料也有,弄出来做笔记,忘记时看一下:<br/>package {<br/> &nbsp;import flash.display.Loader;<br/> &nbsp;import flash.display.Sprite;<br/> &nbsp;import flash.events.*;<br/> &nbsp;import flash.net.URLRequest;<br/><br/> &nbsp;public class LoaderExample extends Sprite {<br/> &nbsp; &nbsp;private var url:String = "top.jpg";<br/><br/> &nbsp; &nbsp;public function LoaderExample() {<br/> &nbsp; &nbsp; &nbsp;var loader:Loader = new Loader();<br/> &nbsp; &nbsp; &nbsp;configureListeners(loader.contentLoaderInfo);<br/> &nbsp; &nbsp; &nbsp;loader.addEventListener(MouseEvent.CLICK, clickHandler);<br/><br/> &nbsp; &nbsp; &nbsp;var request:URLRequest = new URLRequest(url);<br/> &nbsp; &nbsp; &nbsp;loader.load(request);<br/><br/> &nbsp; &nbsp; &nbsp;addChild(loader);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function configureListeners(dispatcher:IEventDispatcher):void {<br/> &nbsp; &nbsp; &nbsp;dispatcher.addEventListener(Event.COMPLETE, completeHandler);<br/> &nbsp; &nbsp; &nbsp;dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);<br/> &nbsp; &nbsp; &nbsp;dispatcher.addEventListener(Event.INIT, initHandler);<br/> &nbsp; &nbsp; &nbsp;dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);<br/> &nbsp; &nbsp; &nbsp;dispatcher.addEventListener(Event.OPEN, openHandler);<br/> &nbsp; &nbsp; &nbsp;dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);<br/> &nbsp; &nbsp; &nbsp;dispatcher.addEventListener(Event.UNLOAD, unLoadHandler);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function completeHandler(event:Event):void {<br/> &nbsp; &nbsp; &nbsp;trace("completeHandler: " + event);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function httpStatusHandler(event:HTTPStatusEvent):void {<br/> &nbsp; &nbsp; &nbsp;trace("httpStatusHandler: " + event);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function initHandler(event:Event):void {<br/> &nbsp; &nbsp; &nbsp;trace("initHandler: " + event);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function ioErrorHandler(event:IOErrorEvent):void {<br/> &nbsp; &nbsp; &nbsp;trace("ioErrorHandler: " + event);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function openHandler(event:Event):void {<br/> &nbsp; &nbsp; &nbsp;trace("openHandler: " + event);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function progressHandler(event:ProgressEvent):void {<br/> &nbsp; &nbsp; &nbsp;trace("progressHandler: bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function unLoadHandler(event:Event):void {<br/> &nbsp; &nbsp; &nbsp;trace("unLoadHandler: " + event);<br/> &nbsp; &nbsp;}<br/><br/> &nbsp; &nbsp;private function clickHandler(event:MouseEvent):void {<br/> &nbsp; &nbsp; &nbsp;trace("clickHandler: " + event);<br/> &nbsp; &nbsp; &nbsp;var loader:Loader = Loader(event.target);<br/> &nbsp; &nbsp; &nbsp;loader.unload();<br/> &nbsp; &nbsp;}<br/> &nbsp;}<br/>}
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?216</link>
<title><![CDATA[AS3键盘响应事件]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[FLASH学习]]></category>
<pubDate>Fri, 18 Apr 2008 03:35:06 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?216</guid> 
<description>
<![CDATA[ 
	AS3键盘响应事件<br/>在响应用户的键盘输入操作时，Flash® Player 将调度 KeyboardEvent 对象。 有两种类型的键盘事件：KeyboardEvent.KEY_DOWN 和 KeyboardEvent.KEY_UP 由于按键与特定字符之间的映射因设备和操作系统而异，因此使用 TextEvent 事件类型来处理字符输入。若以全局方式侦听按键事件，请在舞台上侦听捕获阶段、目标阶段或冒泡阶段。以下示例使用 KeyboardEventExample 类来说明键盘事件及其侦听器函数。 该示<br/><br/>例执行下列任务：<br/>它声明了以后在设置正方形的背景颜色和大小时使用的属性。<br/>它创建一个新的 Sprite 实例，名称为 child。<br/>使用 Sprite 的方法，它通过调用 addChild() 方法绘制一个浅蓝色正方形，其显示在舞台上的默认坐标 (0,0) 处。<br/>它添加了两个键盘类型事件侦听器：<br/>keyDown/keyDownHandler，按下任何键时将调度这两个侦听器。 订阅者方法使用 trace() 语句输出有关事件的信息。<br/>keyUp / keyUpHandler，在释放某个键时进行调度。<br/>在某些情况下，您可能需要单击舞台，键盘事件才能工作。<br/>package {<br/> &nbsp; &nbsp;import flash.display.Sprite;<br/> &nbsp; &nbsp;import flash.display.DisplayObject;<br/> &nbsp; &nbsp;import flash.events.*;<br/> <br/> &nbsp; &nbsp;public class KeyboardEventExample extends Sprite {<br/> &nbsp; &nbsp; &nbsp; &nbsp;private var bgColor:uint = 0x00CCFF;<br/> &nbsp; &nbsp; &nbsp; &nbsp;private var size:uint = 80;<br/> <br/> &nbsp; &nbsp; &nbsp; &nbsp;public function KeyboardEventExample() {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var child:Sprite = new Sprite();<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;child.graphics.beginFill(bgColor);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;child.graphics.drawRect(0, 0, size, size);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;child.graphics.endFill();<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addChild(child);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;stage.focus = child;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;child.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;child.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/> <br/> &nbsp; &nbsp; &nbsp; &nbsp;private function keyDownHandler(event:KeyboardEvent):void {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("keyDownHandler: " + event.keyCode);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("ctrlKey: " + event.ctrlKey);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("keyLocation: " + event.keyLocation);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("shiftKey: " + event.shiftKey);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("altKey: " + event.altKey);<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/> <br/> &nbsp; &nbsp; &nbsp; &nbsp;private function keyUpHandler(event:KeyboardEvent):void {<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trace("keyUpHandler: " + event.keyCode);<br/> &nbsp; &nbsp; &nbsp; &nbsp;}<br/> &nbsp; &nbsp;}<br/>}<br/><br/>//-------------------<br/><br/><br/>//时间轴测试<br/>// create a text field to show key just pressed info<br/>var keyboardText:TextField = new TextField();<br/>keyboardText.selectable = false;<br/>addChild (keyboardText);<br/>// create a text field to whether spacbar is pressed<br/>var spacebarText:TextField = new TextField();<br/>spacebarText.selectable = false;<br/>spacebarText.y = 30;<br/>addChild (spacebarText);<br/>spacebarText.text &nbsp;= "Spacebar is UP.";<br/>var spacebarPressed:Boolean = false;<br/>stage.addEventListener (KeyboardEvent.KEY_DOWN, keyDownFunction);<br/>function keyDownFunction (event:KeyboardEvent)<br/>{<br/> keyboardText.text = "Key Pressed: "+String.fromCharCode(event.charCode);<br/> if (event.charCode == 32)<br/> {<br/> &nbsp;spacebarPressed = true;<br/> &nbsp;spacebarText.text = "Spacebar is DOWN.";<br/> }<br/>}<br/>stage.addEventListener (KeyboardEvent.KEY_UP, keyUpFunction);<br/>function keyUpFunction (event:KeyboardEvent)<br/>{<br/> if (event.charCode == 32)<br/> {<br/> &nbsp;spacebarPressed = false;<br/> &nbsp;spacebarText.text &nbsp;= "Spacebar is UP.";<br/> }<br/> <br/>}
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?215</link>
<title><![CDATA[AS3理解Stage]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[FLASH学习]]></category>
<pubDate>Thu, 17 Apr 2008 06:54:33 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?215</guid> 
<description>
<![CDATA[ 
	Stage 类代表主绘图区。 <br/>舞台表示显示 Flash ® 内容的整个区域。 无法以全局方式访问 Stage 对象。<br/> 而是需要利用 DisplayObject 实例的 stage 属性进行访问。<br/>stage对齐: align<br/>一个 StageAlign 类中指定舞台在 Flash Player 或浏览器中的对齐方式的值。 以下是有效值： <br/>值 垂直对齐方式 水平对齐方式 <br/><br/>StageAlign.TOP 顶对齐 居中对齐 <br/>StageAlign.BOTTOM 底对齐 居中对齐 <br/>StageAlign.LEFT 居中对齐 左对齐 <br/>StageAlign.RIGHT 居中对齐 右对齐 <br/>StageAlign.TOP_LEFT 顶对齐 左对齐 <br/>StageAlign.TOP_RIGHT 顶对齐 右对齐 <br/>StageAlign.BOTTOM_LEFT 底对齐 左对齐 <br/>StageAlign.BOTTOM_RIGHT 底对齐 右对齐 <br/><br/>使舞台左对齐顶对齐: stage.align = StageAlign.TOP_LEFT; <br/>stage缩放属性: scaleMode<br/>一个 StageScaleMode 类中指定要使用哪种缩放模式的值。 以下是有效值： <br/>StageScaleMode.EXACT_FIT -- 整个 Flash 应用程序在指定区域中可见，且不发生扭曲，同时保持应用程序的原始高宽比。 应用程序的两侧可能会显示边框。 <br/>StageScaleMode.SHOW_ALL -- 整个 Flash 应用程序在指定区域中可见，但不尝试保持原始高宽比。 可能会发生扭曲。 <br/>StageScaleMode.NO_BORDER -- 整个 Flash 应用程序填满指定区域，不发生扭曲，但有可能进行一些裁切，同时保持应用程序的原始高宽比。 <br/>StageScaleMode.NO_SCALE -- 整个 Flash 应用程序的大小固定，因此，即使播放器窗口的大小更改，它也会保持不变。 如果播放器窗口比内容小，则可能进行一些裁切。 <br/>ex. stage.scaleMode = StageScaleMode.NO_SCALE;<br/>fullScreen事件<br/>若要启用全屏模式，请将 allowFullScreen 参数添加到包含 SWF 文件的 HTML 页中的 object 和 embed 标签，同时将 allowFullScreen 设置为 "true"，如下例所示： <br/><param name="allowFullScreen" value="true" /><br/>给swf增加一个全屏按钮: fullBt<br/>代码如下：<br/>fullBt.addEventListener(MouseEvent.CLICK,fullscreenshow);<br/>function fullscreenshow(evt:MouseEvent):void {<br/> &nbsp; switch (stage.displayState) {<br/> &nbsp; &nbsp;case "normal" :<br/> &nbsp; &nbsp; stage.displayState = "fullScreen";<br/> &nbsp; &nbsp; break;<br/> &nbsp; &nbsp;case "fullScreen" :<br/> &nbsp; &nbsp;default :<br/> &nbsp; &nbsp; stage.displayState = "normal";<br/> &nbsp; &nbsp; break;<br/> &nbsp; }<br/> &nbsp;}<br/>特别强调resize事件<br/>resize事件，可以用来制作自适就尺寸的swf，当swf的播放窗口size改变，触发该事件。<br/>ex.<br/>package {<br/>import flash.display.Sprite;<br/>import flash.display.StageAlign;<br/>import flash.display.StageScaleMode;<br/>import flash.events.Event;<br/>public class StageExample extends Sprite {<br/>public function StageExample() {<br/>stage.scaleMode = StageScaleMode.NO_SCALE;<br/>stage.align = StageAlign.TOP_LEFT;<br/>stage.addEventListener(Event.ACTIVATE, activateHandler);<br/>stage.addEventListener(Event.RESIZE, resizeHandler);<br/>}<br/>private function activateHandler(event:Event):void {<br/>trace("activateHandler: " + event);<br/>}<br/>private function resizeHandler(event:Event):void {<br/>trace("resizeHandler: " + event);<br/>trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);<br/>}<br/>}<br/>}
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?214</link>
<title><![CDATA[as3——改变对齐方式]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[FLASH学习]]></category>
<pubDate>Thu, 17 Apr 2008 06:52:53 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?214</guid> 
<description>
<![CDATA[ 
	as3——改变对齐方式<br/> &nbsp; &nbsp;用stage.align属性可以改变播放器中影片的对齐方式。<br/> &nbsp; &nbsp;flash影片默认的是在播放器中心显示。通过设置任何DisplayObject的子类的stage.align属性控制播放器中影片的对齐方式。重要的对齐模式作为字符串来执行，就像&quot;T&quot;代表&quot;top&quot;，&quot;L&quot;代表&quot;left&quot;等等。然而，为了避免打字错误，它们被当作flash.display.StageAlign类的属性列入下表： <br/>值<br/>StageAlign.TOP<br/><br/>StageAlign.BOTTOM<br/><br/>StageAlign.LEFT<br/><br/>StageAlign.RIGHT<br/><br/>StageAlign.TOP_LEFT<br/><br/>StageAlign.TOP_RIGHT<br/><br/>StageAlign.BOTTOM_LEFT<br/><br/>StageAlign.BOTTOM_RIGHT<br/><br/> &nbsp; &nbsp;没有&quot;official&quot;值来对齐播放器中垂直和水平都在中间。当然，如果想要这样，你不用采取任何措施因为这是默认模式。但是你从其它的模式向要返回到中心对齐模式，其它模式的任何字符串都不匹配场景的中心。最简单和最安全的是设置成空字符&quot;&quot;。<br/> &nbsp; &nbsp;下面的类示范在播放器中缩放模式和对齐影片的效果。尝试改变stage.scaleMode和stage.align的属性和缩放播放器的尺寸。<br/>package {<br/> &nbsp;import flash.display.Sprite;<br/> &nbsp;import flash.display.StageScaleMode;<br/> &nbsp;import flash.display.StageAlign;<br/><br/> &nbsp;public class ExampleApplication extends Sprite {<br/> &nbsp; &nbsp;public function ExampleApplication( &nbsp;) {<br/><br/> &nbsp; &nbsp; &nbsp;stage.scaleMode = StageScaleMode.NO_SCALE;<br/> &nbsp; &nbsp; &nbsp;stage.align = StageAlign.TOP_RIGHT;<br/> &nbsp; &nbsp; &nbsp;<br/> &nbsp; &nbsp; &nbsp;graphics.beginFill(0xff0000);<br/> &nbsp; &nbsp; &nbsp;graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);<br/> &nbsp; &nbsp; &nbsp;graphics.endFill( &nbsp;);<br/> &nbsp; &nbsp;}<br/> &nbsp;}<br/>}<br/>
]]>
</description>
</item><item>
<link>http://www.starwish.com.cn/read.php?213</link>
<title><![CDATA[关于FLASH自适应窗口大小的做法]]></title> 
<author>starwish &lt;&gt;</author>
<category><![CDATA[FLASH学习]]></category>
<pubDate>Thu, 17 Apr 2008 06:51:20 +0000</pubDate> 
<guid>http://www.starwish.com.cn/read.php?213</guid> 
<description>
<![CDATA[ 
	关于FLASH自适应窗口大小的做法<br/>相信很多朋友学AS2.0到一定阶段以后，对FLASH自适应窗口大小的做法都会好奇<br/><br/>其实方法很简单：<br/><br/>FLASH 里AS就几句话<br/>Stage.align = &quot;TL&quot;;<br/>Stage.scaleMode = &quot;noScale&quot;;<br/>var obj=new Object()<br/>obj.onResize = function() {<br/>//这里可以设置当舞台大小改变时的动作<br/>//详细的看帮助文档的Stage类<br/>mc2._x = Stage.width-mc2._width-10;<br/>};<br/>Stage.addListener(obj);
]]>
</description>
</item>
</channel>
</rss>