flash 调用 脚本
Download the sample files here.
在此处下载示例文件 。
1. Create two circular objects, and make one larger than the other.
1.创建两个圆形对象,并使其一个大于另一个。
2. Convert both these objects into movieclips.
2.将这两个对象都转换为动画片段。
3. Give the larger circular object an instance name of "parent".
3.为较大的圆形对象指定实例名称“父级”。
4. Give the smaller one the instance name "child1".
4.将较小的实例命名为“ child1”。
5. Create a diagonal line as shown below.
5.创建一条对角线,如下所示。
6. Convert it to a movie clip and give it an instance name of "line".
6.将其转换为影片剪辑,并为其指定实例名称“ line”。
7. Right click "child1", go to actions, and insert the action:
7.右键单击“ child1”,转到操作,然后插入操作:
onClipEvent (load) { spring = false; startX = _x; startY = _y; spX = 0; spY = 0; _root.line._visible = 1; parentx = _root.parent._x; parenty = _root.parent._y; _root.line._x = parentx; _root.line._y = parenty; _root.line._xscale = _root.child1._x-parentx; _root.line._yscale = _root.child1._y-parenty; } onClipEvent (mouseDown) { startDrag ("", true); spring = true; } onClipEvent (mouseUp) { stopDrag (); spring = false; } onClipEvent (enterFrame) { parentx = _root.parent._x; parenty = _root.parent._y; _root.line._x = parentx; _root.line._y = parenty;// _root.line._xscale = _root.child1._x-parentx; _root.line._yscale = _root.child1._y-parenty;
//!spring = if false if (!spring) {
//code to create the movements spX += (startX-_x); spY += (startY-_y); spX *= .09; spY *= .09; _x += spX; _y += spY; } }
8. That's it! Press ctrl+enter to test the movie.
翻译自: https://www.sitepoint.com/script-ball-line-effect/
flash 调用 脚本