查看: 917|回复: 7
|
请教 Flash Action Script : Cordination
[复制链接]
|
|
发表于 9-5-2006 12:40 PM
|
显示全部楼层
有一点不是很明白
- this.onMouseMove=function(){
- mse2._x=this._xmouse;
- mse2._y=this._ymouse;
- mse1._x=this._xmouse;
- mse1._y=this._ymouse;
- }
复制代码
01:为何 Obj01 , Obj02 和 mouse 的 cordinate 不一样的? 如何才可以一样?
这个as是把两个mc跟着mouse的,应该就解答这个问题吧
试下这个as
- this.onMouseMove=function(){
- mse2._x=this._xmouse+30;
- mse2._y=this._ymouse+30;
- mse1._x=this._xmouse;
- mse1._y=this._ymouse;
- }
复制代码
如果在后面加上+30或类似的数值,就是更改mc和鼠标的位置
可如果要解答第二道问题,是要object慢慢跟着鼠标,最后贴向鼠标及和鼠标一样位置?
试下这个as
[ 本帖最后由 yawchoong 于 9-5-2006 12:43 PM 编辑 ] |
|
|
|
|
|
|
|
楼主 |
发表于 9-5-2006 02:15 PM
|
显示全部楼层
谢谢指教 但我没有受过 正统的 flash 教育
什么是 as 和 mc ? |
|
|
|
|
|
|
|
发表于 9-5-2006 07:32 PM
|
显示全部楼层
as=action script 脚本语言
mc=movie clip 元件的其中一种 |
|
|
|
|
|
|
|
发表于 9-5-2006 07:36 PM
|
显示全部楼层
原帖由 旌洋-君 于 9-5-2006 07:44 AM 发表
本人做了个关以 Cordination 的 flash 但有两个不明白的地方
请各位帮帮忙
问题
01:为何 Obj01 , Obj02 和 mouse 的 cordinate 不一样的? 如何才可以一样?
02:如何 使 Obj02 慢慢的跟着 mouse 飘过去 ...
01. 不明白你問的問題,請説明在哪的坐標不一樣
02. 把Obj02的代碼去掉,把以下代碼貼在第一個frame就可以了
mouse_position.text = "Mouse Cordinate[ x:" + _xmouse + " y:" + _ymouse + "]"; // Capture Mouse Cordinate
obj01_position.text = "Obj01 Cordinate[ x:" + Obj01._x + " y:" + Obj01._y + "]"; // Capture Obj01 Cordinate
obj02_position.text = "Obj02 Cordinate[ x:" + Obj02._x + " y:" + Obj02._y + "]"; // Capture Obj02 Cordinate
//以上是樓主原本就用來顯示目前鼠標﹐obj01 和 obj02 的﹐注意看 .text 就知道是 textfield 屬性
Obj02.onEnterFrame = function() {
this._x -= (this._x - _xmouse) * .05;
this._y -= (this._y - _ymouse) * .05;
}
stop();
[ 本帖最后由 super-tomato 于 16-5-2006 01:59 PM 编辑 ] |
|
|
|
|
|
|
|
楼主 |
发表于 10-5-2006 01:10 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 16-5-2006 02:11 AM
|
显示全部楼层
奇怪,super tomato,为什么还要加
mouse_position.text = "Mouse Cordinate[ x:" + _xmouse + " y:" + _ymouse + "]"; // Capture Mouse Cordinate
obj01_position.text = "Obj01 Cordinate[ x:" + Obj01._x + " y:" + Obj01._y + "]"; // Capture Obj01 Cordinate
obj02_position.text = "Obj02 Cordinate[ x:" + Obj02._x + " y:" + Obj02._y + "]"; // Capture Obj02 Cordinate 呢?
然后在你的其他教学
Obj02.onEnterFrame = function() {
this._x -= (this._x - _xmouse) * .05;
this._y -= (this._y - _ymouse) * .05;
updateAfterEvent();
}
加这个就行,然后onEnterFrame也可以是onMouseMove
如果方便,可以解释吗? |
|
|
|
|
|
|
|
楼主 |
发表于 16-5-2006 09:51 AM
|
显示全部楼层
yawchoong 兄
上面的是要用来 display position 的 和 mouse follow 是没有关系的
下面的是要用来 mouse follow 的 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|