大家看过这个效果吗?
Flash: http://sz.gd.chinamobile.com/SXT/images/imgshow.swf
中国移动广东深圳分公司
里面的代码是:
-----------------------------------------------
// Action script...
// [Action in Frame 1]
function onMouseMove()
{
moving = true;
counter = 100;
counter2 = 0;
} // End of the function
function onEnterFrame()
{
if (counter2 > 0)
{
var _loc2 = 200;
if (counter2 % _loc2 == 1)
{
_root["menu" + (Math.floor(counter2 / _loc2) % 5 + 1)].hit.onRollOver();
} // end if
++counter2;
}
else if (counter <= 0)
{
counter = 0;
moving = false;
counter2 = 1;
}
else if (moving)
{
--counter;
} // end else if
} // End of the function
var mtx1 = 533;
var mtx2 = 800;
MovieClip.prototype.sXMove = function (spx, tarX)
{
speedX = spx * (tarX - this._x);
this._x = this._x + speedX;
};
_root.mask1.onEnterFrame = function ()
{
if (random(30) == 1)
{
mtx1 = random(800);
} // end if
this.sXMove(1.000000E-002, mtx1);
};
_root.mask2.onEnterFrame = function ()
{
if (random(30) == 1)
{
mtx2 = random(800);
} // end if
this.sXMove(1.000000E-002, mtx2);
};
MovieClip.prototype.sMove = function (spy, tarx)
{
speedx = spy * (tarx - this._x);
this._x = this._x + speedx;
};
var mty1 = 0;
var mty2 = 100;
var mty3 = 200;
var mty4 = 300;
var mty5 = 400;
_root.menu1.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty1);
};
_root.menu2.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty2);
};
_root.menu3.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty3);
};
_root.menu4.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty4);
};
_root.menu5.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty5);
};
_root.menu1.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 410;
_root.mty3 = 440;
_root.mty4 = 470;
_root.mty5 = 500;
_root.menu1.movie1.gotoAndPlay(2);
_root.menu2.movie1.gotoAndStop(1);
_root.menu3.movie1.gotoAndStop(1);
_root.menu4.movie1.gotoAndStop(1);
_root.menu5.movie1.gotoAndStop(1);
};
_root.menu2.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 30;
_root.mty3 = 440;
_root.mty4 = 470;
_root.mty5 = 500;
_root.menu1.movie1.gotoAndPlay(1);
_root.menu2.movie2.gotoAndStop(2);
_root.menu3.movie3.gotoAndStop(1);
_root.menu4.movie4.gotoAndStop(1);
_root.menu5.movie5.gotoAndStop(1);
};
_root.menu3.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 30;
_root.mty3 = 60;
_root.mty4 = 470;
_root.mty5 = 500;
_root.menu1.movie1.gotoAndPlay(1);
_root.menu2.movie2.gotoAndStop(1);
_root.menu3.movie3.gotoAndStop(2);
_root.menu4.movie4.gotoAndStop(1);
_root.menu5.movie5.gotoAndStop(1);
};
_root.menu4.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 30;
_root.mty3 = 60;
_root.mty4 = 90;
_root.mty5 = 500;
_root.menu1.movie1.gotoAndPlay(1);
_root.menu2.movie2.gotoAndStop(1);
_root.menu3.movie3.gotoAndStop(1);
_root.menu4.movie4.gotoAndStop(2);
_root.menu5.movie5.gotoAndStop(1);
};
_root.menu5.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 30;
_root.mty3 = 60;
_root.mty4 = 90;
_root.mty5 = 120;
_root.menu1.movie1.gotoAndPlay(1);
_root.menu2.movie2.gotoAndStop(1);
_root.menu3.movie3.gotoAndStop(1);
_root.menu4.movie4.gotoAndStop(1);
_root.menu5.movie5.gotoAndStop(2);
};
var moving = false;
var counter = 0;
var counter2 = 0;
-----------------------------------------------
小刀(我)点评:我们可以看出它是Flash5/6做成的。
本人经过努力的尝试终于完成了;
而且可能效果也不差,也可以修改成引出外部jpg、swf的呢。下面请各位测试;
//先看效果吧:
//////////////下面是代码//////////////////////
import mx.transitions.Tween;
var RA:Array = new Array();
var LA:Array = new Array();
var l_r:Boolean = true;
var imgTotal = 5;
var imgs:MovieClip = this.createEmptyMovieClip("imgs", 1);
for (var i = 0; i<=imgTotal; i++) {
var temp_mc:MovieClip = imgs.attachMovie("mc"+(i+1), "mc"+i, i);
temp_mc._x = 20*i;
//temp_mc._y = 50;
temp_mc.dis = temp_mc._width-20;
temp_mc.r = false;
var m:MovieClip = temp_mc.attachMovie("a", "m", 1);
m.a_txt.text = "这是"+i;
m.a_txt.selectable = false;
m.selected = false;
m.onPress = onPin2;
}
function picmove(target:MovieClip) {
var _mc = target;
var myTween:Tween = new Tween(_mc, "_x", mx.transitions.easing.Bounce.easeOut,
_mc._x, _mc._x+_mc.dis, 1, true);
myTween.onMotionChanged = function() {
stopAll(imgs);
};
myTween.onMotionFinished = function() {
target.dis *= -1;
target.r = !target.r;
onAll(imgs);
var _t_n = target._name.substr(2, 1);
trace("_t_n="+_t_n);
if (_t_n == imgTotal) {
if (!target.r) {
r_l_flag = true;
torightstart_id = imgTotal;
}
}
if (_t_n == 1) {
if (target.r) {
r_l_flag = false;
toleftstart_id = 1;
}
}
};
}
function stopAll(target:MovieClip) {
var _l1 = target;
for (var k in _l1) {
_l1[k].m.onPress = null;
}
}
function onAll(target) {
var _l1 = target;
for (var k in _l1) {
_l1[k].m.onPress = onPin2;
}
}
function onPin() {
var pmc = this._parent;
picmove(pmc);
}
function onPout() {
//
}
function onPin2() {
var p:MovieClip = this._parent;
var nn = p._name.substr(2, 1);
if(nn==0)return false;
trace("点击了"+nn);
if(r_l_flag){
torightstart_id=Number(nn)-1;
}else{
toleftstart_id= Number(nn)+1;
}
if (!p.r) {
if (nn != 0) {
for (var j = nn; j<=imgTotal; j++) {
var _t_mc:MovieClip = _root.imgs["mc"+j];
if (!_t_mc.r) {
picmove(_t_mc);
}
//if
}
//for
}
} else {
for (var j = nn; j>0; j--) {
var _t2_mc:MovieClip = _root.imgs["mc"+j];
if (_t2_mc.r) {
picmove(_t2_mc);
}
}
}
}
var r_l_flag = true;
var toleftstart_id = 1;
var torightstart_id = imgTotal;
function toleftshow() {
var _t1 = _root.imgs["mc"+toleftstart_id];
picmove(_t1);
toleftstart_id++;
}
function torightshow() {
var _t2 = _root.imgs["mc"+torightstart_id];
picmove(_t2);
torightstart_id--;
}
function auto_run2() {
if (r_l_flag) {
torightshow();
trace("右右"+torightstart_id);
} else {
toleftshow();
trace("左"+toleftstart_id);
}
}
interID = setInterval(auto_run2, 3000);
///////////////////////////////////////////////
请各位朋友测试,看是否有bug,也欢迎朋友们讨论
附件: 06小刀-中国移动网图片效果.swf (2006-10-23 23:13, 106.22 K)
该附件被下载次数 1
Flash: http://sz.gd.chinamobile.com/SXT/images/imgshow.swf
中国移动广东深圳分公司
里面的代码是:
-----------------------------------------------
// Action script...
// [Action in Frame 1]
function onMouseMove()
{
moving = true;
counter = 100;
counter2 = 0;
} // End of the function
function onEnterFrame()
{
if (counter2 > 0)
{
var _loc2 = 200;
if (counter2 % _loc2 == 1)
{
_root["menu" + (Math.floor(counter2 / _loc2) % 5 + 1)].hit.onRollOver();
} // end if
++counter2;
}
else if (counter <= 0)
{
counter = 0;
moving = false;
counter2 = 1;
}
else if (moving)
{
--counter;
} // end else if
} // End of the function
var mtx1 = 533;
var mtx2 = 800;
MovieClip.prototype.sXMove = function (spx, tarX)
{
speedX = spx * (tarX - this._x);
this._x = this._x + speedX;
};
_root.mask1.onEnterFrame = function ()
{
if (random(30) == 1)
{
mtx1 = random(800);
} // end if
this.sXMove(1.000000E-002, mtx1);
};
_root.mask2.onEnterFrame = function ()
{
if (random(30) == 1)
{
mtx2 = random(800);
} // end if
this.sXMove(1.000000E-002, mtx2);
};
MovieClip.prototype.sMove = function (spy, tarx)
{
speedx = spy * (tarx - this._x);
this._x = this._x + speedx;
};
var mty1 = 0;
var mty2 = 100;
var mty3 = 200;
var mty4 = 300;
var mty5 = 400;
_root.menu1.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty1);
};
_root.menu2.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty2);
};
_root.menu3.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty3);
};
_root.menu4.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty4);
};
_root.menu5.onEnterFrame = function ()
{
this.sMove(5.000000E-001, mty5);
};
_root.menu1.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 410;
_root.mty3 = 440;
_root.mty4 = 470;
_root.mty5 = 500;
_root.menu1.movie1.gotoAndPlay(2);
_root.menu2.movie1.gotoAndStop(1);
_root.menu3.movie1.gotoAndStop(1);
_root.menu4.movie1.gotoAndStop(1);
_root.menu5.movie1.gotoAndStop(1);
};
_root.menu2.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 30;
_root.mty3 = 440;
_root.mty4 = 470;
_root.mty5 = 500;
_root.menu1.movie1.gotoAndPlay(1);
_root.menu2.movie2.gotoAndStop(2);
_root.menu3.movie3.gotoAndStop(1);
_root.menu4.movie4.gotoAndStop(1);
_root.menu5.movie5.gotoAndStop(1);
};
_root.menu3.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 30;
_root.mty3 = 60;
_root.mty4 = 470;
_root.mty5 = 500;
_root.menu1.movie1.gotoAndPlay(1);
_root.menu2.movie2.gotoAndStop(1);
_root.menu3.movie3.gotoAndStop(2);
_root.menu4.movie4.gotoAndStop(1);
_root.menu5.movie5.gotoAndStop(1);
};
_root.menu4.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 30;
_root.mty3 = 60;
_root.mty4 = 90;
_root.mty5 = 500;
_root.menu1.movie1.gotoAndPlay(1);
_root.menu2.movie2.gotoAndStop(1);
_root.menu3.movie3.gotoAndStop(1);
_root.menu4.movie4.gotoAndStop(2);
_root.menu5.movie5.gotoAndStop(1);
};
_root.menu5.hit.onRollOver = function ()
{
_root.mty1 = 0;
_root.mty2 = 30;
_root.mty3 = 60;
_root.mty4 = 90;
_root.mty5 = 120;
_root.menu1.movie1.gotoAndPlay(1);
_root.menu2.movie2.gotoAndStop(1);
_root.menu3.movie3.gotoAndStop(1);
_root.menu4.movie4.gotoAndStop(1);
_root.menu5.movie5.gotoAndStop(2);
};
var moving = false;
var counter = 0;
var counter2 = 0;
-----------------------------------------------
小刀(我)点评:我们可以看出它是Flash5/6做成的。
本人经过努力的尝试终于完成了;
而且可能效果也不差,也可以修改成引出外部jpg、swf的呢。下面请各位测试;
//先看效果吧:
//////////////下面是代码//////////////////////
import mx.transitions.Tween;
var RA:Array = new Array();
var LA:Array = new Array();
var l_r:Boolean = true;
var imgTotal = 5;
var imgs:MovieClip = this.createEmptyMovieClip("imgs", 1);
for (var i = 0; i<=imgTotal; i++) {
var temp_mc:MovieClip = imgs.attachMovie("mc"+(i+1), "mc"+i, i);
temp_mc._x = 20*i;
//temp_mc._y = 50;
temp_mc.dis = temp_mc._width-20;
temp_mc.r = false;
var m:MovieClip = temp_mc.attachMovie("a", "m", 1);
m.a_txt.text = "这是"+i;
m.a_txt.selectable = false;
m.selected = false;
m.onPress = onPin2;
}
function picmove(target:MovieClip) {
var _mc = target;
var myTween:Tween = new Tween(_mc, "_x", mx.transitions.easing.Bounce.easeOut,
_mc._x, _mc._x+_mc.dis, 1, true);
myTween.onMotionChanged = function() {
stopAll(imgs);
};
myTween.onMotionFinished = function() {
target.dis *= -1;
target.r = !target.r;
onAll(imgs);
var _t_n = target._name.substr(2, 1);
trace("_t_n="+_t_n);
if (_t_n == imgTotal) {
if (!target.r) {
r_l_flag = true;
torightstart_id = imgTotal;
}
}
if (_t_n == 1) {
if (target.r) {
r_l_flag = false;
toleftstart_id = 1;
}
}
};
}
function stopAll(target:MovieClip) {
var _l1 = target;
for (var k in _l1) {
_l1[k].m.onPress = null;
}
}
function onAll(target) {
var _l1 = target;
for (var k in _l1) {
_l1[k].m.onPress = onPin2;
}
}
function onPin() {
var pmc = this._parent;
picmove(pmc);
}
function onPout() {
//
}
function onPin2() {
var p:MovieClip = this._parent;
var nn = p._name.substr(2, 1);
if(nn==0)return false;
trace("点击了"+nn);
if(r_l_flag){
torightstart_id=Number(nn)-1;
}else{
toleftstart_id= Number(nn)+1;
}
if (!p.r) {
if (nn != 0) {
for (var j = nn; j<=imgTotal; j++) {
var _t_mc:MovieClip = _root.imgs["mc"+j];
if (!_t_mc.r) {
picmove(_t_mc);
}
//if
}
//for
}
} else {
for (var j = nn; j>0; j--) {
var _t2_mc:MovieClip = _root.imgs["mc"+j];
if (_t2_mc.r) {
picmove(_t2_mc);
}
}
}
}
var r_l_flag = true;
var toleftstart_id = 1;
var torightstart_id = imgTotal;
function toleftshow() {
var _t1 = _root.imgs["mc"+toleftstart_id];
picmove(_t1);
toleftstart_id++;
}
function torightshow() {
var _t2 = _root.imgs["mc"+torightstart_id];
picmove(_t2);
torightstart_id--;
}
function auto_run2() {
if (r_l_flag) {
torightshow();
trace("右右"+torightstart_id);
} else {
toleftshow();
trace("左"+toleftstart_id);
}
}
interID = setInterval(auto_run2, 3000);
///////////////////////////////////////////////
请各位朋友测试,看是否有bug,也欢迎朋友们讨论
附件: 06小刀-中国移动网图片效果.swf (2006-10-23 23:13, 106.22 K)
该附件被下载次数 1
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}