articles

2009 年 8 月 4 日

AS3 fl.transitions

CATEGORYactionscript   4:19 AM

を用いたクラスを作っておきました。
なにかと便利かと思います(自分にとって)
もはや、タイムラインをいじることはないのでしょうか?

package {
	import flash.display.MovieClip;
	import fl.motion.easing.Elastic;

	import fl.transitions.TransitionManager;
	import fl.transitions.Transition;
	import fl.transitions.easing.Regular;
	import fl.transitions.Fade;
	import fl.transitions.Blinds;
	import fl.transitions.easing.None;
	import fl.transitions.PixelDissolve;
	import fl.transitions.Squeeze;
	import fl.transitions.Zoom;


	public class Transitions {

		var rvar:int;
		var transition_mc:MovieClip;
		var transition_status:Object = new Object();

		public function Transitions(mc) {
			transition_mc=mc;
		}

		public function createTransition() {
			rvar=Math.floor(Math.random()*5);
			trace(rvar);
			
			switch (rvar) {
				case 0 :
					transition_status.type=Fade;
					transition_status.direction=Transition.IN;
					transition_status.duration=1;
					transition_status.easing=Regular.easeInOut;

				case 1 :
					transition_status.type=Blinds;
					transition_status.direction=Transition.IN;
					transition_status.duration=1;
					transition_status.easing=None.easeNone;
					transition_status.numStrips=10;
					transition_status.dimension=0;
				case 2 :
					transition_status.type=PixelDissolve;
					transition_status.direction=Transition.IN;
					transition_status.duration=1;
					transition_status.easing=Regular.easeIn;
					transition_status.xSections=30;
					transition_status.ySections=30;
				case 3 :
					transition_status.type=Squeeze;
					transition_status.direction=Transition.IN;
					transition_status.duration=1;
					transition_status.easing=Elastic.easeInOut;
					transition_status.dimension=2;
				case 4 :
					transition_status.type=Zoom;
					transition_status.direction=Transition.IN;
					transition_status.duration=2;
					transition_status.easing=Elastic.easeInOut;
			}
			var transitionMng:TransitionManager=new TransitionManager(transition_mc);
			transitionMng.startTransition(transition_status);
		}

	}
}

利用するflaファイルのスクリプト

import Transitions;

var trs=new Transitions(test_mc);

stage.addEventListener(MouseEvent.CLICK,action);
function action(event) {
	trs.createTransition();
}