发新话题
打印

[原创]图片效果系列之二

本帖已经被作者加入个人空间

[原创]图片效果系列之二

import flash.filters.ColorMatrixFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;
var nowI:Number;
smallbg.targetx = (Stage.width-smallbg._width)/2;
function aa(i:Number) {
function brightnessWatcher(prop:String, oldVal:Number, newVal:Number, img_mc:MovieClip):Number {
  var brightness_array:Array = [1, 0, 0, 0, newVal, 0, 1, 0, 0, newVal, 0, 0, 1, 0, newVal, 0, 0, 0, 1, 0];
  colorMF = new ColorMatrixFilter(brightness_array);
  img_mc.filters = [colorMF];
  return newVal;
}
this.createEmptyMovieClip("img_mc", 0);
img_mc.attachMovie("pic"+i, "pic"+i, i);
img_mc._x = (Stage.width-img_mc._width)/2;
img_mc._y = (Stage.height-img_mc._height)-40;
img_mc.watch("brightness", brightnessWatcher, img_mc);
var t:Object = new Tween(img_mc, "brightness", Elastic.easeOut, 100, 0, 5, true);
nowI = i;
}
aa(1);
for (j=1; j<7; j++) {
this.smallbg["btnmc"+j].no = j;
this.smallbg["btnmc"+j]._alpha = 80;
this.smallbg["btnmc"+j].useHandCursor = false;
this.smallbg["btnmc"+j].onRelease = function() {
  a = this.no;
  if (nowI != a) {
   aa(a);
  }
};
this.smallbg["btnmc"+j].onRollOver = function() {
  this._alpha = 100;
};
this.smallbg["btnmc"+j].onRollOut = function() {
  this._alpha = 80;
};
}
onEnterFrame = function () {
smallbg._x += (smallbg.targetx-smallbg._x)*0.2;
if (Math.abs(smallbg.targetx-smallbg._x)<=0.2) {
  smallbg._x = smallbg.targetx;
  delete onEnterFrame;
}
};
stop();
//////////////以下为自动调用外部图片的代码/////////////////////////////////////////////////////////////////////////////////////////////
function aaa(i:Number) {
this.createEmptyMovieClip("img_mc", 10);
var img_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip):Void  {
  // 使影片剪辑实例在舞台上居中
  target_mc._x = (Stage.width-target_mc._width)/2;
  target_mc._y = Stage.height-target_mc._height;
  target_mc.watch("brightness", brightnessWatcher, target_mc);
  // 为 target_mc 影片剪辑添加动画效果,使其亮度在 -100 到 +100 之间变化
  var t:Object = new Tween(target_mc, "brightness", Elastic.easeOut, 100, 0, 3, true);
  ////////设置自动播放影片的代码////////////////////////////////////////////////////////////
  //t.onMotionFinished = function() {                                             
  //if (i<6) {
  //i = i+1;
  //} else {
  //i = 1;
  //}
  //trace(ID);
  //ID = setInterval(aa, 3000, i);
  //};
  ////////////////////////////////////////////////////////////////////////
};
img_mcl.addListener(mclListener);
img_mcl.loadClip("img/photo"+i+".jpg", img_mc);
function brightnessWatcher(prop:String, oldVal:Number, newVal:Number, target_mc:MovieClip):Number {
  var brightness_array:Array = [1, 0, 0, 0, newVal, 0, 1, 0, 0, newVal, 0, 0, 1, 0, newVal, 0, 0, 0, 1, 0];
  colorMF = new ColorMatrixFilter(brightness_array);
  target_mc.filters = [colorMF];
  return newVal;
}
nowI = i;
//if (ID != undefined) {
//clearInterval(ID);
//}
//trace("lID="+ID)  
}

[[i] 本帖最后由 steamlin 于 2006-11-20 11:08 编辑 [/i]]
http://steamlin.flash8.net
网站建设/域名、空间租用..www.china-space.cn
蓝莫名博http://www.20click.com/cn/index.php?u=steamlin

TOP

-_-

附件

图片效果系列之二.fla (1.03 MB)

2006-11-20 10:53, 下载次数: 774

图片效果系列之二.swf (829.19 KB)

2006-11-20 10:53, 下载次数: 783

http://steamlin.flash8.net
网站建设/域名、空间租用..www.china-space.cn
蓝莫名博http://www.20click.com/cn/index.php?u=steamlin

TOP

效果不错,谢谢楼主分享!

TOP

你这都是以代码为主哦

TOP

支持 楼主

TOP

不错

TOP

引用:
原帖由 tiger_0309 于 2006-11-20 11:39 发表
你这都是以代码为主哦
看上去,好多代码.其实.用来用去都是那么几句的...呵呵..
http://steamlin.flash8.net
网站建设/域名、空间租用..www.china-space.cn
蓝莫名博http://www.20click.com/cn/index.php?u=steamlin

TOP

goog

TOP

四个效果都下载了,回去慢慢学习

TOP

收了,好贴

收了,好贴

TOP

发新话题