代碼如下:
import mx.transitions.*;
import mx.transitions.easing.*;
var r:Number = 45;
var p:Number = 0;
var drag:Boolean = false;
var num:Number = 0;
var name_array:Array = new Array("閃", "吧", "2", "0", "0", "8", "興", "旺", "發(fā)", "展");
this.createEmptyMovieClip("container", this.getNextHighestDepth());
/*旋轉(zhuǎn)*/
function start_func() {
for (var i:Number = 0; i<=9; i++) {
container.attachMovie("ball", "ball"+i, i);
container["ball"+i]._x = 225+r*(Math.abs(4.5-i))*Math.cos((135-(Math.floor((i/5))*180))*Math.PI/180);
container["ball"+i]._y = 225+r*(Math.abs(4.5-i))*Math.sin((135-(Math.floor((i/5))*180))*Math.PI/180);
container["ball"+i].txt.text = name_array[i];
container["ball"+i].i = i;
container["ball"+i].onEnterFrame. = function() {
var my_color:Color = new Color(this._mc);
my_color.setRGB(Math.random()*0xFFFFFF);
this._x = 225+r*(Math.abs(4.5-this.i))*Math.cos(((135-(Math.floor((this.i/5))*180))+p)*Math.PI/180);
this._y = 225+r*(Math.abs(4.5-this.i))*Math.sin(((135-(Math.floor((this.i/5))*180))+p)*Math.PI/180);
p = p+0.5;
};
container["ball"+i].onPress = function() {
var myTween:Tween = new Tween(this, "_xscale", Elastic.easeOut, 100, 200, 1, true);
var myTween:Tween = new Tween(this, "_yscale", Elastic.easeOut, 100, 200, 1, true);
};
container["ball"+i].onRelease = function() {
var myTween:Tween = new Tween(this, "_xscale", Elastic.easeOut, 200, 100, 1, true);
var myTween:Tween = new Tween(this, "_yscale", Elastic.easeOut, 200, 100, 1, true);
};
}
}
start_func();
/*拖動(dòng)跟隨*/
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
if (container["ball"+0].hitTest(_root._xmouse, _root._ymouse)) {
drag = true;
}
};
mouseListener.onMouseMove = function() {
if (drag) {
num = 1;
delete container["ball"+0].onEnterFrame;
container["ball"+0]._x = _root._xmouse;
container["ball"+0]._y = _root._ymouse;
for (var i:Number = 1; i<=9; i++) {
delete container["ball"+i].onEnterFrame;
container["ball"+i]._x += (container["ball"+(i-1)]._x-container["ball"+i]._x)/3;
container["ball"+i]._y += (container["ball"+(i-1)]._y-container["ball"+i]._y)/3;
}
}
};
mouseListener.onMouseUp = function() {
drag = false;
/*拖動(dòng)后才能恢復(fù)*/
if(num==1){
start_func();
num=0;
}
};
Mouse.addListener(mouseListener);
絢麗的閃字動(dòng)畫(huà)Flash AS特效 -電腦資料
【www.oriental01.com - 電腦資料】
最新文章
- 折半查找算法的實(shí)現(xiàn) -電腦資料
- 回調(diào)函數(shù)應(yīng)用(冒泡排序 既排整
- thinkphp 關(guān)于iis上面中文參數(shù)亂
- 自定義SectionAdapter顯示數(shù)據(jù) -
- java克隆對(duì)象clone()的用法和作
- static, enum, 內(nèi)部類(lèi)與單例模式
- Java多線程學(xué)習(xí)(吐血超詳細(xì)總結(jié)
- Java中幾個(gè)容易混淆的相似概念和
推薦文章
- Java中幾個(gè)容易混淆的相似概念和
- Struts2基本讀寫(xiě)法上傳文件 -電
- Java設(shè)計(jì)模式——工廠模式 -電腦
- AOJ 0118 Property Distribution
- bzoj1305[CQOI2009]dance 跳舞 -
- C# GetHashCode 的實(shí)現(xiàn)方式 -電
- 工廠模式 -電腦資料
- 用C++實(shí)現(xiàn)一個(gè)Log系統(tǒng) -電腦資料