flash鼠标跟随代码怎么打

2022-07-14 08:16:15   第一文档网     [ 字体: ] [ 阅读: ] [ 文档下载 ]
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。下载word有问题请添加QQ:admin处理,感谢您的支持与谅解。点击这里给我发消息

#第一文档网# 导语】以下是®第一文档网的小编为您整理的《flash鼠标跟随代码怎么打》,欢迎阅读!
跟随,鼠标,代码,怎么,flash

本文整理于网络,仅供阅读参考



flash鼠标跟随代码怎么打





flash鼠标跟随代码怎么打? 方法一:

1、先做个影片剪辑代替你的鼠标 2、给你要跟随的影片剪辑起个名字叫aa 3、在你这个影片剪辑中写 onclipevent (enterframe) { this._x=_level0._xmouse; this._x=_level0._ymouse; }

4、隐藏鼠标 mouse.hide();写在主场景的帧上 方法二:

mc为屏幕中的剪辑对象 startdrag(mc,true);

//mc可拖动,拖动点为mc的中心 mouse.hide(); //隐藏鼠标 var i:number = 0; //定义变量i,值为0 onmousemove = function(){ //当鼠标移动时


本文整理于网络,仅供阅读参考

attachmovie("mc","mc"+i,i);

//从库中加载链接名为mc的元件到屏幕中作为实例,命名为mc+1

this["mc"+i]._x = _xmouse; this["mc"+i]._y = _ymouse; //这些实例与鼠标坐标位置相同 i+=1

//随着鼠标移动,实例数量递增 }; 方法三:

1.新建一个影片剪辑元件,画上你要想跟随的效果 2.把影片剪辑拖到场景中,点中影片剪辑,到属性面板取实例名为:cursor_mc

3.新建一个图层把脚本粘贴到图层二的第一桢,控制测试影

const speed:int = 10;

stage.addeventlistener(event.enter_frame,onenter); function onenter(evt:event){

if(math.abs(evt.target.mousex-cursor_mc.x)>2||math.abs(evt.target.mousey-cursor_mc.y)>2) {

cursor_mc.x+=(evt.target.mousex-cursor_mc.x)/speed;//


本文整理于网络,仅供阅读参考

动就靠这个

cursor_mc.y+=(evt.target.mousey-cursor_mc.y)/speed;//动就靠这个 }else{

cursor_mc.x = evt.target.mousex; cursor_mc.y = evt.target.mousey; } }




本文来源:https://www.dywdw.cn/38442da083c758f5f61fb7360b4c2e3f5727258a.html

相关推荐
推荐阅读