原作品是06世界杯临近期间英文雅虎页面上的阿迪达斯倒计时牌冠名广告。设计富有金属质感,属于我比较喜欢的风格。反编译以后发现代码比较乱,然后手就有点痒,再然后就有了下面的代码。首先是CountDown的类,其中handler是Function类型的公有变量,该函数将用于处理怎么显示倒计时代码。class CountDown {
privatevarfinalTime:Date;
privatevarcurrentTime:Date;
privatevartimeDiff:Number;
publicvarhandler:Function =null;
publicfunctionCountDown(date:Date){this.finalTime = date !=null? date :newDate(1900,0,0,0,0,0);
}
privatefunctioninit():Void{this.currentTime =newDate();this.timeDiff = finalTime.getTime() - currentTime.getTime();if(this.timeDiff <0)this.timeDiff =0;
}
publicfunctionrun():Void{i
...
继续阅读
(4)