佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 917|回复: 7

请教 Flash Action Script : Cordination

[复制链接]
发表于 9-5-2006 07:44 AM | 显示全部楼层 |阅读模式
本人做了个关以 Cordination 的 flash 但有两个不明白的地方
请各位帮帮忙

问题
01:为何 Obj01 , Obj02 和 mouse 的 cordinate 不一样的? 如何才可以一样?

02:如何 使 Obj02 慢慢的跟着 mouse 飘过去?

作品:
Flash: http://http://www.geocities.com/art_design1/9899/Cordination.swf

法式法哦
回复

使用道具 举报


ADVERTISEMENT

发表于 9-5-2006 12:40 PM | 显示全部楼层
有一点不是很明白


  1. this.onMouseMove=function(){
  2. mse2._x=this._xmouse;
  3. mse2._y=this._ymouse;
  4. mse1._x=this._xmouse;
  5. mse1._y=this._ymouse;
  6. }

复制代码



01:为何 Obj01 , Obj02 和 mouse 的 cordinate 不一样的? 如何才可以一样?

这个as是把两个mc跟着mouse的,应该就解答这个问题吧

试下这个as


  1. this.onMouseMove=function(){
  2. mse2._x=this._xmouse+30;
  3. mse2._y=this._ymouse+30;
  4. mse1._x=this._xmouse;
  5. mse1._y=this._ymouse;
  6. }

复制代码

如果在后面加上+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 | 显示全部楼层
原帖由 super-tomato 于 9-5-2006 07:36 PM 发表



01. 不明白你問的問題,請説明在哪的坐標不一樣

02. 把Obj02的代碼去掉,把以下代碼貼在第一個frame就可以了

mouse_position.text = "Mouse Cordinate[ x:" + _xmouse + " y:" + ...




谢谢 学到新东西了

各位Action Script的你们都是会 Java 的吗?
回复

使用道具 举报

Follow Us
发表于 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 的
回复

使用道具 举报


ADVERTISEMENT

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 22-9-2024 03:53 PM , Processed in 0.121997 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表