方便调用27种FLASH图片切换特效
网上一直都是说,用flash做的课件功能比PPT强大些,但是用flash做课件时,其实面临着一个尴尬的问题,就是遇上课件中需要切换显示大量图片时,做起来相当麻烦,至少比在PPT中做时要麻烦许多,网上也流传着用transitions 及tween类切换图片,但要么不实用,要么效果单调,经过慢慢分析这两种类的用法后,牺牲一个下午终于在flash中把flash中切换显示图片这个另人头痛的问给解决了,共27种图片切换特效,以后做课件又可以省不少力了,直接准备好图像文件调用即可,代码帖出如下:
//首先准备十四张图片在 .fla 文件相同目录下,文件名分别为: 1.jpg ,2.jpg,...,14.jpg
//该段代码在第一个关键帧复制过去即可
//该段代码在理解时,要弄清flash as 中的数组时面向对象的,否则该段程序可能有些不好懂的哦
import mx.transitions.*;
import mx.transitions.easing.*;
fscommand("fullscreen", true); //全屏
var showID:Number = 0; //特效类型代码
var mc_array = new Array(14);//定义数组准备存储14个mc对象,其中每个mc对象在后面将加载图片
//定义数组存储27种图片切换参数,其中各特效具体参数还可直接在其中更改
var str_array = new Array(27); //flash 中的数组是面向对象的,大家学了C后这点变通应该没有问题吧
//遮帘(纵向、横向)
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};
//飞行过渡(九个不同的方向)
str_array[4] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:1};
str_array[5] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:2};
str_array[6] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:3};
str_array[7] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:4};
str_array[8] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:5};
str_array[9] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:6};
str_array[10] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:7};
str_array[11] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:8};
str_array[12] = {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:9};
//光圈过渡
str_array[13] = {type:Iris, direction:Transition.IN, duration:2, easing:Strong.easeOut, startPoint:5, shape:Iris.CIRCLE};
//渐变暴光
str_array[14] = {type:Photo, direction:Transition.IN, duration:1, easing:None.easeNone};
//像素溶解
str_array[15] = {type:PixelDissolve, direction:Transition.IN, duration:2, easing:None.easeNone, xSections:50, ySections:50};
//旋转过渡
str_array[16] = {type:Rotate, direction:Transition.IN, duration:3, easing:Strong.easeInOut,
ccw:false, degrees:360};
//挤压过渡(二个方向)
str_array[17] = {type:Squeeze, direction:Transition.IN, duration:2, easing:Elastic.easeOut, dimension:1};
str_array[18] = {type:Squeeze, direction:Transition.IN, duration:2, easing:Elastic.easeOut, dimension:2};
//划入划出过渡--左上,1;上中,2;右上,3;左中,4;右中,6;左下,7;下中,8;右下,9
str_array[19] = {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:1};
str_array[20] = {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:2};
str_array[21] = {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:3};
str_array[22] = {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:4};
str_array[23] = {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:6};
str_array[24] = {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone,
startPoint:7};
str_array[25] = {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:8};
str_array[26] = {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:9};
//弹性缩放
str_array[27] = {type:Zoom, direction:Transition.IN, duration:2, easing:Elastic.easeOut};
//采用数组载入全部图片,注:直接全部载入比较耗内存,如要节约内存的话,可定义两个mc采用类似双缓冲法进行改写,不过在这里重点是写出flash中内置的全部图片切换特效,以后有时间再改进
for (i=0; i<=13; i++) {
mc_array[i] = _root.createEmptyMovieClip("mc"+String(i+1), i+1);
mc_array[i].loadMovie(String(i+1)+".jpg", i+1);
}
//载入图片后,把各图片mc 的位置摆放整齐,这里每张图片的大小都经过处理,尺寸完全一样(改变图片大小用photoshop一张张处理的话,比较麻烦,但是以前在做政务公开系统更新程序的时候,写过一个程序,来个批处理,眨几下眼的时间二、三十张图片就都处理完了。
for (i=1; i<=14; i++) {
with(eval("mc"+i))
{
_x=20;
_y=40;
_xscale=120;
_yscale=120;
}
}
//设置定时器调用图片切换函数
setInterval(showImages, 4000);
//图片切换函数
function showImages() {
mx.behaviors.DepthControl.bringToFront(mc_array[showID]); // 将下一个要切换的mc 置顶
mx.transitions.TransitionManager.start(mc_array[showID], str_array[random(27)]); //随机特效将图片按顺序切换
if (showID++ == 13) {
HTML网页特效CSS大全 css属性代码大全 一CSS文字属性: color : #999999; /*文字颜色*/ font-family : 宋体,sans-serif; /*文字字体*/ font-size : 9pt; /*文字大小*/ font-style:itelic; /*文字斜体*/ font-variant:small-caps; /*小字体*/ letter-spacing : 1pt; /*字间距离*/ line-height : 200%; /*设置行高*/ font-weight:bold; /*文字粗体*/ vertical-align:sub; /*下标字*/ vertical-align:super; /*上标字*/ text-decoration:line-through; /*加删除线*/ text-decoration: overline; /*加顶线*/ text-decoration:underline; /*加下划线*/ text-decoration:none; /*删除链接下划线*/ text-transform : capitalize; /*首字大写*/ text-transform : uppercase; /*英文大写*/ text-transform : lowercase; /*英文小写*/ text-align:right; /*文字右对齐*/ text-align:left; /*文字左对齐*/ text-align:center; /*文字居中对齐*/ text-align:justify; /*文字分散对齐*/ vertical-align属性 vertical-align:top; /*垂直向上对齐*/ vertical-align:bottom; /*垂直向下对齐*/ vertical-align:middle; /*垂直居中对齐*/ vertical-align:text-top; /*文字垂直向上对齐*/ vertical-align:text-bottom; /*文字垂直向下对齐*/ 二、CSS边框空白 padding-top:10px; /*上边框留空白*/ padding-right:10px; /*右边框留空白*/ padding-bottom:10px; /*下边框留空白*/ padding-left:10px; /*左边框留空白 三、CSS符号属性: list-style-type:none; /*不编号*/ list-style-type:decimal; /*阿拉伯数字*/ list-style-type:lower-roman; /*小写罗马数字*/ list-style-type:upper-roman; /*大写罗马数字*/ list-style-type:lower-alpha; /*小写英文字母*/ list-style-type:upper-alpha; /*大写英文字母*/