} this.isHiting=true; }else{ this.isHiting=false; } };//为MovieClip添加域成员listen成员,用于监视当前对象与目标是否碰撞 MovieClip.prototype.watch=function(target){ this.timer=setInterval(this,"listen",50,target); };//以每50毫秒检测一次的速度来检测是否碰撞 MovieClip.prototype.unWatch=function(){ clearInterval(this.timer); };//停止对对象的监视 ASBroadcaster.initialize(MovieClip.prototype);//初始化MovieClip原型为事件源 //下面是调用的示例 //假设有两个MovieClip,左边ball,右边wall,让ball不断往wall移动,同时监视wall,一旦击中触发事件onHitTest ball.onEnterFrame=function(){ this._x+=5; };//让ball不断往右方移动工 myListener=newObject(); myListener.onHitTest=function(source,target){ trace("The"+source._name+"hit"+target._name+"."); }; ball.addListener(myListener);//创建监听员并注册给ball ball.watch(wall);//让ball监视wall [page_break] MD5 32位码的Flash算法 以下是引用片段: //----------- functionmd5(s){ returnbinl2hex(core_md5(str2binl(s),s.length*strsize)); } functioncore_md5(x,len){ x[len>>5]=(x[len>>5])|(128<<len%32); x[(((len+64)>>>9)<<4)+14]=len; vara=1732584193; varb=-271733879; varc=-1732584194; vard=271733878; vari=0; while(ivarolda=a; varoldb=b; varoldc=c; varoldd=d; a=md5_ff(a,b,c,d,x[i+0],7,-680876936); d=md5_ff(d,a,b,c,x[i+1],12,-389564586); c=md5_ff(c,d,a,b,x[i+2],17,606105819); b=md5_ff(b,c,d,a,x[i+3],22,-1044525330); a=md5_ff(a,b,c,d,x[i+4],7,-176418897); d=md5_ff(d,a,b,c,x[i+5],12,1200080426); c=md5_ff(c,d,a,b,x[i+6],17,-1473231341); |