实现图片切换效果
这是一个图片切换效果,纯Flash as;问题是这个效果是图片无限切换,我想要的只是切换完10张图片就停止,然后我可以指定跳到某帧播放我想要的画面。
代码如下:
import mx.transitions.*;
import mx.transitions.easing.*;
var showID:Number = 0;
var mc_array = new Array(10);
var str_array = new Array(3);
str_array[0] = {type:Blinds, direction:Transition.IN, duration:2, easing:None.easeNone, numStrips:20, dimension:0};
str_array[1] = {type:Blinds, direction:Transition.IN, duration:2, easing:None.easeNone, numStrips:20, dimension:1};
str_array[2] = {type:Fade, direction:Transition.IN, duration:3, easing:None.easeNone};
str_array[3] = {type:Fade, direction:Transition.OUT, duration:3, easing:None.easeNone};
for (i=0; i<=9; i++) {
mc_array[i] = _root.createEmptyMovieClip("mc"+String(i+1), i+1);
mc_array[i].loadMovie(String(i+1)+".jpg", i+1);
}
for (i=0; i<=9; i++) {
mc_array[i] = _root.createEmptyMovieClip("mc"+String(i+1), i+1);
mc_array[i].loadMovie(String(i+1)+".jpg", i+1);
}
for (i=1; i<=10; i++) {
with(eval("mc"+i))
{
_x=0.0;
_y=-51.0;
}
}
var T=setInterval(showImages, 4000);
function showImages() {
mx.behaviors.DepthControl.bringToFront(mc_array[showID]);
mx.transitions.TransitionManager.start(mc_array[showID], str_array[random(3)]);
if (showID++ > 9) {
clearInterval(T)};//同时还要注意用removeMovieClip 摧毁这10个MC,否则 _root.createEmptyMovieClip("mc"+String(i+1), i+1);这一行就用负深度,把i+1改成i-20
gotoAndStop(你要的帧);
}
}
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |