public class CarousselTwo (Flash 10)
The CarousselTwo class is used to create image caroussels. The movement can be changed to waves and the view can be changed. The CarousselTwo class is different from the CarousselOne class, since objects can be rotated around their axis and circles can be created with more depth of the objects in the back. To create an instance of the CarousselTwo use the constructor new CarousselTwo().

See also


Public Properties
Property Defined By
setAngleFactor : Number
To alter the movement to waves.
setAlpha : Boolean
If true the scene will be dimmed.
setRotation : Boolean
If true the objects will rotate along the y-axis according to their position inside the circle.
Public Methods
Method Defined By
Creates a new instance of the CarousselTwo class.
setParams(container:Sprite, objectA:Object, pathWidth:int, pathHeight:int, xr:int, yr:int, angle:Number, viewDist:int=50, objRot:Number=0):void
Will initiate the tween when an instance of the CarousselTwo class exists.
changeTimer(count:int, angle:Number=1):void
Allows to change the speed for the circle to move and the angle in which the objects are oriented to each other.
goMoreCircle(objectArray:Array=null, myNum:int=1, numObjects:int=1, speedFactor:int=1):void  method
This method will initiate the movement of the caroussel.
Event Defined By
All inherited events for the Sprite class. N/A
Property Detail
setAngleFactor property
setAngleFactor:Number [read-write]

Changing the value will alter the movement. Increasing the value will cause the objects to jump while decreasing will cause the circle to move in a different angle.

The default value is 1.


public function get setAngleFactor():Number
public function set setAngleFactor(value:Number):void

setAlpha property
setAlpha:Boolean [read-write]

If true all objects will behave reduced alpha.

The default value is false.


public function get setAlpha():Boolean
public function set setAlpha(value:Boolean):void

setRotation property
setRotation:Boolean [read-write]

To cause objects to rotate by themselves according to the position in the circle set setRotation to true.

The default value is false.


public function get setRotation():Boolean
public function set setRotation(value:Boolean):void
Constructor Detail
CarousselTwo ()  Constructor
public function CarousselTwo()
Intializes a new CarousselTwo instance.
Method Detail

setParams()  method
public function setParams(container:Sprite, objectA:Object, pathWidth:int, pathHeight:int, xr:int, yr:int, angle:Number, viewDist:int=50, objRot:Number=0):void

This method will initiate the caroussel methods.


  • container:Sprite ____ This is an optional container (Sprite), which is holding all the objects. Create it in the movie.
  • objectA:Object ____ The individual objects of the circle.
  • pathWidth:int ____ The width of the circle.
  • pathHeight:int ____ The height of the circle. This allows to create an ellipse by having different width and height.
  • xr:int ____ The x position of the circle.
  • yr:int ____ The y position of the circle.
  • xo:int ____ Specifies x position of the circle.
  • angle:int ____ Specifies the angle of the objects to each other.
  • viewDist:int=50 ____ Specifies the distance of the circle from the viewer.
  • objRot:int=0 ____ Specifies the rotation of the object. A value less than 1 will cause an angle of the object.

changeTimer()  method
public function changeTimer(count:int, angle:Number):void

This method will initiate the caroussel methods. To change certain properties add the property before the method call:


  • count:int ____ Specifies the delay count for a Timer object and allows to change the speed of the circle movement.
  • angle:Number ____ (Optional) Specifies the angle of the objects in relation to each other. The default value is 1. This function allows to change the angle when the movie is running.

goMoreCircle()  method
public function goMoreCircle(objectArray:Array=null, myNum:int=1, numObjects:int=1, speedFactor:int=1):void

This method will initiate the movement of the caroussel and is required for that.


  • objectArray:Array=null ____ (Optional) Specifies an array of several objects.
  • myNum:int=1 ____ (Optional) value will be more than 1 if more objects are on stage.
  • speedFactor:int=1 ____ Specifies the speed of the circle movement.
  • numObjects:int=1 ____ (Optional) Specifies the total number of objects.
Create a new fla file with the dimensions of 700x500 pixels and name it CarousselTwo.fla. Place the fla in the same folder as the biz folder. Create a MovieClip Models and export for actionscript. Add 9 frames to the MovieClip and keep the first frame empty. Place a stop(); in the first frame. Then place an object (image for example) into each frame. Create a background, give it the identifier "BackImage" and export for actionscript. Then create an Actionscript file, name it and place this script.
	import flash.display.Sprite;
	import flash.display.Loader;
	import biz.flashscript.utils.MultiPreloader;
	import biz.flashscript.animation.CarousselTwo;
	import biz.flashscript.animation.MirrorImage;
	import biz.flashscript.utils.LoaderClassStatic;
	import biz.flashscript.tweens.ApplyTweensTimer;

	public class Carousseltwo extends Sprite
		private var mfArray:Vector.<CarousselTwo> = new Vector.<CarousselTwo>();
		private var at:ApplyTweensTimer;
		private var pathWidth:int = 1000;
		private var pathHeight:int = 150;
		private var xr:int = 0;
		private var yr:int = 20;
		private var angle:Number = 1;
		private var speed:int = 20;
		private var viewDist:int = 50;
		private var objRot:Number = 0.1;
		private var numObj:Number = 8;
		private var speedfactor:Number = 10;
		private var myArray:Array = new Array();
		private var container:Sprite;
		private var myLoader:Loader;

		public function Carousseltwo ():void
			var bg:BackImage=new BackImage();
			addChild (bg);
			var imageArray:Array = new Array("A0.jpg", "A1.jpg", "A2.jpg", "A3.jpg", "A4.jpg", "A5.jpg", "A6.jpg", "A7.jpg");
			var mp:MultiPreloader = new MultiPreloader(imageArray, "images/");
			addChild (mp);
			mp.addEventListener ("loadComplete", onComplete);
		private function onComplete (e:Event):void
			var mp:MultiPreloader = e.currentTarget as MultiPreloader;
			removeChild (mp);
			container=new Sprite();
			addChild (container);
			container.x = 325;
			container.y = 180;
			container.scaleX = 0.5;
			container.scaleY = 0.5;
			for (var i=0; i < numObj; i++)
				var imageHolder:Models=new Models();
				imageHolder.gotoAndStop (i+2);
				imageHolder.i = i;
				myArray.push (imageHolder);
				var mf:CarousselTwo = new CarousselTwo();
				mf.setAngleFactor = 1;
				mf.setParams (container, imageHolder, pathWidth, pathHeight, xr, yr, angle, viewDist, objRot);
				mf.goMoreCircle (myArray, i, numObj, speed);
				mf.setRotation = true;
				mfArray.push (mf);
				imageHolder.buttonMode = true;
				container.addChild (imageHolder);
				var mi:MirrorImage = new MirrorImage();
				imageHolder.addChild (mi);
				mi.setBitmap (imageHolder, 0.5, -85, 25);
			for (var j=0; j < myArray.length; j++)
				container.getChildAt(j).addEventListener (MouseEvent.MOUSE_OVER, mo);
				container.getChildAt(j).addEventListener (MouseEvent.MOUSE_OUT, mu);
				container.getChildAt(j).addEventListener (MouseEvent.CLICK, cl);
				//getChildAt(j).addEventListener (MouseEvent.MOUSE_OVER, mo);
				//getChildAt(j).addEventListener (MouseEvent.MOUSE_OUT, mu);
			var loaderMH:Sprite=new Sprite();
			loaderMH.buttonMode = true;
			addChild (loaderMH);
			myLoader = new Loader();
			loaderMH.addChild (myLoader);
			loaderMH.x = 190;
			loaderMH.y = 40;
			import biz.flashscript.filters.DropShadow;
			var myShadow:DropShadow = new DropShadow(loaderMH);

		private function mo (e:MouseEvent):void
			for (var j=0; j < mfArray.length; j++)
				mfArray[j].changeTimer (50, 0.1);
		private function mu (e:MouseEvent):void
			for (var j=0; j < mfArray.length; j++)
				mfArray[j].changeTimer (50, 2);
		private function cl (e:MouseEvent):void
			myLoader.addEventListener (MouseEvent.CLICK, lcl);
			if (myLoader.width != 0)
				myLoader.unloadAndStop ();
			var url:String = "images/A" + (e.currentTarget.i) + ".jpg";
			myLoader.load (new URLRequest(url));
			myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, comHandler);
		private function lcl (event:MouseEvent):void
			if (myLoader.width != 0)
				at = new ApplyTweensTimer(event.currentTarget.content.parent, 75, "alphaOut", 10, 1000);
				at.initTweens ();
				at.addEventListener (ApplyTweensTimer.CALL_BACK,  callHandler);
				function callHandler (event:Event):void
					myLoader.unloadAndStop ();
		private function comHandler (event:Event):void
			at = new ApplyTweensTimer(event.currentTarget.content.parent, 75, "alphaIn", 1, 1000);
			at.initTweens ();