In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

calrender

20091120 月表示の件修正しました。ご指摘ありがとうございます
//20091120 月表示の件修正しました。ご指摘ありがとうございます
package {

	import flash.display.*;
	import flash.events.*;
	import flash.filters.*;
	import flash.text.*;
	import flash.utils.*;
	
    // Tweener
	import caurina.transitions.Tweener;
	import caurina.transitions.properties.FilterShortcuts;
	FilterShortcuts.init();
	
	[SWF(width = "465", height = "465", backgroundColor = 0x999900, frameRate = "60")]

	public class calendar extends Sprite {

		private var oldX:Number;
		private var oldY:Number;

		private var counting:Number;
		private var dd:Date=new Date();
		
		private var blockArray:Array;
		
		private var myArrayS:Array;		
		private var myArrayX:Array;
		private var myArrayY:Array;
		
		private var StringDate:String;
		private var todayUint:uint;
		
		/**
		 * コンストラクタ 
		 */
		public function calendar() {
			myArrayS=["C","a","l","e","n","d","a","r"];
			myArrayX=[0,20,40,60,80,100,120,140];
			myArrayY=[0,0,0,0,0,0,0,0];
			var _Month:Array=["January","February","March","April","May","June","July","August","September","October","November","December"];
			
			blockArray=new Array();
			counting=0;
			StringDate=dd.fullYear+"."+(dd.month+1)+"."+dd.date+" "+_Month[dd.month];
			
			makeString();
		}
		
		private function makeString(){			
			for(var i:int=0; i<StringDate.length; i++){
				 myArrayS.push(StringDate.charAt(i));
				 myArrayX.push(i*22);
				 myArrayY.push(40);
			}
			Calender0();			
		}


/*----------------------------------------------------------------------------------------------------*/
var _Lastday:Array=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var myDate:Date=new Date();
var array0:Array=new Array();
var lastDays:uint;

	private function Calender0(){
			myDate.setFullYear(dd.fullYear,dd.month,1);
			var firstweek:Number=myDate.getDay();		
			var ck1:Boolean=false;
			var countDays=1;	
			//日数
			lastDays=_Lastday[dd.month];
			if(dd.month==1){
			if(( dd.fullYear % 4 == 0 ) && ( dd.fullYear % 100 != 0 || dd.fullYear % 400 == 0 )){lastDays=29}else{lastDays=28}	
			}
			
			for (var j:uint=0; j < 6; j++) {
				array0[j]=new Array ;
				for (var jj:uint=0; jj <7; jj++) {
					if(ck1==false&&firstweek!=jj){array0[j][jj]=8;}
					else{array0[j][jj]=jj;ck1=true;
					if(countDays>lastDays){array0[j][jj]=8;}else{countDays++;}			
					}
				}
			}
			Calender1();
		}
		
		private function Calender1(){
					var countDays=1;
					
					for (var j:uint=0; j < 6; j++) {
					for (var jj:uint=0; jj <7; jj++) {
							
							if(array0[j][jj]!=8){
								myArrayS.push(countDays.toString());
								if(dd.date==countDays){todayUint=myArrayS.length-1;}								
								countDays++;

							}else{
								myArrayS.push("");
							}
							myArrayX.push(10+jj*60);
							myArrayY.push(100+j*60);
														
					}
					}
					
			addEventListener(Event.ENTER_FRAME, createParticle );
		}
/*----------------------------------------------------------------------------------------------------*/
				
		/**
		 * パーティクル生成 
		 */
		private function createParticle(event:Event):void {

			if (counting==myArrayS.length-1) {removeEventListener(Event.ENTER_FRAME, createParticle);finishToday();}			

			oldX = mouseX;
			oldY = mouseY;

			var mc:MovieClip = new MovieClip();

			//テキストフォーマット作成                
			var fmt:TextFormat = new TextFormat();
			fmt.size  = 64;
			fmt.align = TextFormatAlign.CENTER;
			fmt.color = 0xffffff;
			fmt.font="Impact"

			//テキストフィールド作成
			var tf:TextField = new TextField();
			tf.defaultTextFormat = fmt;
			tf.text = myArrayS[counting];
			tf.selectable = false;

			//表示
			mc.addChild(tf);
			mc.x = oldX;
			mc.y = oldY;

			mc.filters = [ new BlurFilter(20, 20, 1) ];
			
			blockArray.push(mc);

			Tweener.addTween(mc,
			{
				x : 20+myArrayX[counting],
				y : 20+myArrayY[counting],
				scaleX:0.4,
				scaleY:0.4,
				_Blur_blurX:0,_Blur_blurY:0,
				_Glow_color: 0x669900, _Glow_alpha: 100, _Glow_blurX: 12, _Glow_blurY: 12, _Glow_strength: 3,				
				time : 1,
				transition : "easeOutBack"								
			});

			this.addChild(mc);
			counting++;
		}
		
		private function finishToday():void {	
			var mc:MovieClip = blockArray[todayUint];
			Tweener.addTween(mc , {_Glow_color: 0xffffff, _Glow_alpha: 100, _Glow_blurX: 50, _Glow_blurY: 50, _Glow_strength: 5,delay:1, time:2});
		}		
		
	}
}