This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* JacksonDunstan.com 的 http://jacksondunstan.com/articles/2461 | |
* 介绍了在as3中创建"Multi-Line Strings"的方式,在后继评论中叙述了 | |
* 可以使用xml的CDATA标签方便创建多行字符。 | |
* | |
* 使用xml的CDATA标签创建多行字符最初应该是由 http://ticore.blogspot.com 提出 | |
* 但是创建的多行字符使用trace输出会发现格式有问题(空行的行数) | |
* 可以使用正则表达式修正 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.display.DisplayObject; | |
import flash.events.MouseEvent; | |
/** | |
* @see http://blog.iconara.net/2008/03/30/separating-event-handling-from-event-filtering/ | |
* | |
* @example | |
* container is a Sprite Container, childA and childB and container's children |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.display.Bitmap; | |
import flash.display.BitmapData; | |
import flash.display.DisplayObject; | |
import flash.display.Graphics; | |
import flash.display.IGraphicsData; | |
import flash.display.MovieClip; | |
import flash.display.Shape; | |
import flash.display.Sprite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
/** | |
* @see http://www.oyvindnordhagen.com/blog/2010/09/06/quick-as3-tip-find-out-where-a-function-was-called-from/ | |
* | |
* 添加判断方法的类型 | |
* 添加判断swf是否为debug版, 避免getStackTrace返回为空 | |
* @return 返回的字符串格式为 类 --> 方法 --> 具体行数 | |
*/ | |
public function getCaller():String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj:Object = Object.prototype; | |
//获取对象长度 | |
obj.getLength = function():int{ | |
var len:int = 0; | |
for(var item:* in this){ | |
len++; | |
} | |
return len; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.utils.Dictionary; | |
/** | |
* 1.robertPenner的Signal如果在遍历中直接修改存储signal的链表, 则不会反映到当前遍历中(会在下一次派发中体现) | |
* 2.PureMVC中存储Observer的数组, 最终进行播报Notification时, 也是如此(先复制一份当前结构的副本,以避免播报过程中数组索引被修改) | |
* 3.RichardLord的Ash框架中使用链表结构实现了自己的Signal, 可以实现在播报Signal监听方法时, 直接修改(删除,添加)链表结构 | |
* 4.jacksondunstan的turbosignals利用了内置的数组结构, 和robertPannner的Signal一样, 但是和PureMVC不同的是, | |
* jacksondunstan直接使用了数组的内置方法进行复制, 而不是通过循环。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.display.DisplayObject; | |
import flash.display.DisplayObjectContainer; | |
import flash.events.Event; | |
import flash.events.IEventDispatcher; | |
import flash.utils.Dictionary; | |
/** | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.events.Event; | |
import flash.events.EventPhase; | |
import flash.events.IEventDispatcher; | |
/** | |
* @see once$ | |
* @example | |
* this.stage.addEventListener(MouseEvent.CLICK, event$(function(evt:MouseEvent, value:int):void{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.events.Event; | |
import flash.events.EventPhase; | |
import flash.events.IEventDispatcher; | |
/** | |
* @see once$ | |
* @example | |
* this.stage.addEventListener(MouseEvent.CLICK, execute$(trace, this, false)(this, "global execute$ method test")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.events.Event; | |
import flash.events.EventPhase; | |
import flash.events.IEventDispatcher; | |
/** | |
* 仅执行一次事件处理方法, 随即删除 | |
* @see http://stackoverflow.com/questions/2476386/as3-event-listener-that-only-fires-once?rq=1 | |
* @example |