论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > Flash教程
Tag:flash cs,flash 8,鼠绘,as,手绘,工具,文字,loading,入门,初学,mc,影片剪辑,声音,mtv,游戏,引导,遮罩,菜单,补间,广告条,时钟,视频教程

拖动,缓动,加投影效果(提供源码下载)

文章类别:Flash | 发表日期:2008-9-21 19:52:09

  拖动,缓动,加投影效果(提供源码下载):

在此谢谢我师兄,昨晚的相助,呵呵~~  (webstudio 里的一个特效制作),  有爱好的,可以一起把它做得更好~哈哈... 占用一下地方上传文件,也分享一下,呵呵~  转载请注明~
import flash.filters.DropShadowFilter;
var filterropShadowFilter = new DropShadowFilter(10, 45, 0x666666, .6, 18, 18, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
var loop:Number;
var grav:Number;
function move() {
this._x += grav*(_root._xmouse-this._x)/loop;
this._y += grav*(_root._ymouse-this._y)/loop;
if (this._x+15 == _root._xmouse+15 || this._y+15 == _root._ymouse+15) {
  //drag = false
  group_mc.filters = null;
} else {
  this.filters = filterArray;
}
//trace(grav)
//trace(loop)
}
var drag:Boolean = false;
group_mc.onPress = function() {
drag = true;
grav = .6;
loop = 1;
};
group_mc.onMouseMove = function() {
if (drag) {
  grav = .1;
  //loop = 10;
  move.call(this);
}
};
group_mc.onRelease = group_mc.onReleaseOutside=function () {
drag = false;
//delete onEnterFrame;
};
group_mc.onEnterFrame = function() {
if (drag) {
  move.call(this);
} else {
  group_mc.filters = null;
}
};
半夜又完善了一下效果,再加一个动态投影下去,效果就完全出来了~ 可以参考这里的教程: http://www.webstudio.com.cn/tutorial/show.php?id=65
filter.blurY=filter.blurX = Math.abs((this._x-_root._xmouse)/3);
                
filter.distance=(this._x-_root._xmouse)/5;
                
this.filters = filterArray;

附件:(1): 拖动效果.rar   (2): Drop.rar

用3.0写了一遍,3.0里没有 events as onReleaseOutside, onDragOut, onDragOver and so on.所以得自己写events类,呵呵~~下次研究一下,再一起讨论共享.
/**
* ...
* @author lby
* @version 0.1
*/

package lbynet{

        import flash.display.Sprite;
        import flash.display.InteractiveObject;
        import flash.events.MouseEvent;
        import flash.events.Event;

        import flash.filters.DropShadowFilter;

        public class Drop {

                private var loop:int;
                private var grav:Number;
                private var can:Boolean = false;

                private var target:InteractiveObject;
                private var stage:Sprite;

                private var blurX:Number;
                private var blurY:Number;

                public function Drop(target:InteractiveObject,stage:Sprite) {

                        this.target = target;
                        this.stage = stage;

                        target.addEventListener(MouseEvent.MOUSE_DOWN,downHander);
                        target.addEventListener(MouseEvent.MOUSE_UP,upHander);
                        target.addEventListener(MouseEvent.MOUSE_MOVE,MoveHander);
                        //target.addEventListener(MouseEvent.MOUSE_OUT,OutHander);
                        target.addEventListener(Event.ENTER_FRAME,EnterFrameHander);
                }
                private function downHander(event:MouseEvent):void {

                        can = true;
                        grav = .6;
                        loop = 1;

                        trace("down");
                }
                private function upHander(event:MouseEvent):void {

                        can = false;
                        trace("UP");
                }
                private function MoveHander(event:MouseEvent):void {
                        if (can) {
                                grav = .1;

                                move();
                        }
                }
                private function OutHander(event:MouseEvent):void {

                        can = false;

                }
                private function EnterFrameHander(event:Event):void {
                        if (can) {
                                move();
                        } else {
                                target.filters = null;
                        }
                }
                private function move():void {
                        trace("move");

                        target.x += grav*(stage.mouseX - target.x)/loop;
                        target.y += grav*(stage.mouseY - target.y)/loop;

                        var filter:DropShadowFilter = new DropShadowFilter(10,45,0x666666,.6,blurX,blurY,1,3,false,false,false);
                        filter.blurX = filter.blurY = Math.abs((target.x-stage.mouseX)/3);
                        filter.distance = (target.x - stage.mouseX)/5;
                        target.filters = [filter];

                }
        }
}
进入论坛和作者讨论学习:http://space.flash8.net/bbs/thread-338355-1-1.html
上一篇:{应用}遮罩弹性跟随效果 人气:2056
下一篇:{应用}拍照效果 人气:3057
视频教程列表
文章教程搜索
 
Flash推荐教程
Flash热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058