/********************************************************************************** class RotationEffect Abstractclass for slidetransition classes Flashscript.biz ***********************************************************************************/ package flashscript.CS4slideshow { import flash.display.*; import flash.events.*; import biz.Flashscript.utils.LoaderClassStatic; import biz.Flashscript.tweens.ApplyTweens; public class RotationEffect extends Sprite { /* We define all variables, which are needed for the slidetransition and used also by the subclasses. */ private static var _imageHolder:Object; private static var _speed:int; private static var _myURL:String; private static var _myXML:XML; private static var alter:Number; private static var _imageWidth:Number; private static var _imageHeight:Number; private var lcs:LoaderClassStatic; public function RotationEffect ():void { alter = Math.floor(3 * Math.random()); } /* This function brings in all the parameters from the Document class. */ public function slideTransition (imageHolder:Object,speed:int,myURL:String,myXML:XML):void { _imageHolder = imageHolder; _imageWidth = imageHolder.width; _imageHeight = imageHolder.height; _speed = speed; _myURL = myURL; _myXML = myXML; } /* The variables are expressed as Getters. They can now be accessed by the subclasses. */ public function get _alter ():Number { return alter; } public function get imageHolder ():Object { return _imageHolder; } public function get imageWidth ():Number { return _imageWidth; } public function get imageHeight ():Number { return _imageHeight; } public function get speed ():Number { return _speed; } public function get myURL ():String { return _myURL; } public function get myXML ():XML { return _myXML; } /* This is the main function, which is overridden by the same function in the subclasses. We create a simple fading as transition here, which will serve as default transition behavior. The fading class "ApplyTweens" can be found in the Flashscript.biz classes. We add an event- listener, which is triggered when the fading event is finished. Then the new slide will be loaded. */ public function timerHandler ():void { var ax:ApplyTweens = new ApplyTweens(imageHolder,20,"alphaOut"); ax.initTweens (); ax.addEventListener (ApplyTweens.CALL_BACK, callHandler); function callHandler (event:Event):void { lcs = new LoaderClassStatic(); lcs.initLoader (myURL,loadingComplete,imageHolder); } } /* This function is triggered when the new slide is loaded. The loading is done by the "LoaderClassStatic" class, which can be found as part of the Flashscript.biz classes. */ private function loadingComplete (event:Event):void { LoaderClassStatic.myDispatcher.removeEventListener (Event.COMPLETE,loadingComplete); var ax:ApplyTweens = new ApplyTweens(imageHolder,20,"alphaIn"); ax.initTweens (); ax.addEventListener (ApplyTweens.CALL_BACK, callHandler); function callHandler (event:Event):void { /* Once fading in is finished we add mouse behavior back to the slidethumbs. */ for (var i=0; i