使用鼠标移动感应移动图片,做网站的朋友兴许能够用的上.以前做过N多个,兴许这么做简单一些.
在第一帧上加入如下代码.picture为图片剪辑,dragControl为一个空的影片剪辑参照.
/*
copyrightbywebstudio.com.cn.authorbyegoldy.2005-10-30
*/
stop();
//影片宽高
varwidthx=400;
varheighx=300;
//循环
onEnterFrame=function(){
//拖动参照移动,只要是利用他的坐标
onMouseMove=function(){
startDrag("dragControl",true);
}
trace(_root.dragControl._x);
//图片移动
_root.picture._x =(dragControl._x*(-1)-picture._x)*0.2;
//结束位置条件
if(dragControl._x>=widthx){
_root.picture._x=-picture._width;
}
//开始位置条件
if(dragControl._x<=-1){
_root.picture._x=-1;
}
}
copyrightbywebstudio.com.cn.authorbyegoldy.2005-10-30
*/
stop();
//影片宽高
varwidthx=400;
varheighx=300;
//循环
onEnterFrame=function(){
//拖动参照移动,只要是利用他的坐标
onMouseMove=function(){
startDrag("dragControl",true);
}
trace(_root.dragControl._x);
//图片移动
_root.picture._x =(dragControl._x*(-1)-picture._x)*0.2;
//结束位置条件
if(dragControl._x>=widthx){
_root.picture._x=-picture._width;
}
//开始位置条件
if(dragControl._x<=-1){
_root.picture._x=-1;
}
}
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




