2005/09/01 | flash进行对浏览器的拖动呢
类别(flash As) | 评论(0) | 阅读(189) | 发表于 18:11
可以在今天就解决了这个问题的朋友,我愿意把我的分数全部给您。
大家就帮帮忙吧。

<script language="javascript" type="text/javascript">
function init()
{
x0=document.body.scrollLeft+event.clientX;
y0=document.body.scrollTop+event.clientY;
}
function move()
{
var x=document.body.scrollLeft+event.clientX-x0;
var y=document.body.scrollTop+event.clientY-y0;
self.moveBy(x,y);
}

</script>
<a href="#" onmousedown=init() ondrag=move()>按住我拖动</a>
这一段是拖动浏览器的javascript,
应该怎样才可以用flash进行对浏览器的拖动呢?

---------------------------------------------------------------

在flash里面做一个movieClip,在上面写action 如下:
onClipEvent (load) {
this.onPress = function() {
this.mDown = true;
};
this.onRelease = function() {
this.mDown = false;
};
this.onReleaseOutside = function() {
this.onRelease();
};
}
onClipEvent (enterFrame) {
if (this.mDown) {
this.onMouseMove = function() {
getURL("javascript:init()");
getURL("javascript:move("+this._xmouse+","+this._ymouse+")");
};
} else {
delete this.onMouseMove;
}
}


------------------------------
将你javascript脚本中的 move()函数修改如下:

function move(x,y)
{
self.moveBy(x,y);
}
0

评论Comments

日志分类
首页[193]
flash As[107]
有的没的[59]
数码照片[4]
自由世界[19]
blender[4]