# Posted By

IsoJon on 03/11/10

# Statistics

Viewed 135 times
Favorited by 0 user(s)

# Create Dotted Line (made of any shape/MC)

/ Published in: ActionScript 3

You can replace the library item with whatever you want, or draw a shape in actionscript to use.

TweenMax is used in this snippet, get it here: http://www.greensock.com/tweenmax/ and thank Jack Doyle for being great by donating.

Copy this code and paste it in your HTML
`// Right click the movieclip you wish to use in the library and // change the linkage name to "Dot" or create your own custom class. // TweenMax is used in this snippet, get it here: http://www.greensock.com/tweenmax/ // and thank Jack Doyle for being great by donating.  import com.greensock.TweenMax; import com.greensock.easing.*; var dotLength : int = 870; 				// the length that you'd like the dot to becreateDotLine( dotLength, 50, 100 );  	// place this anywhere, this creates your dot,                                   		// it takes three parameters: length + x,y of line function createDotLine( dL:int, sX:int, sY:int ) : void{	var dotSprite : Sprite = new Sprite();	dotSprite.y = sY;        dotSprite.x = sX;	addChild(dotSprite); 	while ( dotSprite.width  <=  dL )	{		var w : int = dotSprite.width;		var d : Sprite = new Dot();		d.x = w;		dotSprite.addChild( d );	} 	for ( var i : int = 0; i < dotSprite.numChildren; i++)	{		var dS = dotSprite.getChildAt( i );		var plusMinusY : int;		if ( i % 2 == 0 )		{			plusMinusY = dS.y - 50;		} else {			plusMinusY = dS.y + 50;		} 		TweenMax.from( dS, .7, { alpha:0, y:plusMinusY, x:dS.x - 40, delay:i * .01, ease:Expo.easeInOut });	}}`