ActionScript 3 创建虚线(由任何形状/ MC组成)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 创建虚线(由任何形状/ MC组成)相关的知识,希望对你有一定的参考价值。

// 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 be
createDotLine( 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 });
	}
}

以上是关于ActionScript 3 创建虚线(由任何形状/ MC组成)的主要内容,如果未能解决你的问题,请参考以下文章

如何在 ActionScript 2 中绘制虚线?

ActionScript 3 在Flash中绘制虚线lInes(FOUND)

如何在 Actionscript 3.0 中使用补间形状?

ActionScript 3 绘制工具提示形状

ActionScript 3 基本文档类模板,由FlashDevelop创建

如何创建由 xml 文件驱动的 Adob​​e Flash cs6 Actionscript 3 rtmp 视频播放器?