flash 调用 脚本

tech2024-05-29  77

flash 调用 脚本

1. Start by creating a movie that has the dimensions: width=400 and height=50.

1.首先创建尺寸为:宽度= 400和高度= 50的电影。

2. Create a mouse pointer.

2.创建一个鼠标指针。

3. Now, convert the mouse pointer to a movieclip, name it "pointer", then give it an instance name of "pointer".

3.现在,将鼠标指针转换为动画片段,将其命名为“ pointer”,然后为其指定实例名称为“ pointer”。

4. Using the text tool, type "RUBBER" — it should appear as shown in the movie above.

4.使用文本工具,键入“ RUBBER”(橡胶)-它应如上图所示。

5. Select the text and convert it to a movieclip. Name it "rubber", and give it an instance name of "rubber".

5.选择文本并将其转换为动画片段。 将其命名为“ rubber”,并为其指定实例名称“ rubber”。

Now, double click the text movieclip to go into its timeline.

现在,双击文本动画片段进入其时间轴。

6. Create a new layer, and name it "Button".

6.创建一个新层,并将其命名为“按钮”。

8. In the button layer, create an invisible button.

8.在按钮层中,创建一个不可见的按钮。

9. Apply these actions to the button:

9.将以下操作应用于按钮:

on (rollOver) {  Mouse.hide();  _root.pointer._visible = true; } on (rollOut) {  Mouse.show();  _root.pointer._visible = false; } on (press) {  Mouse.hide();  _root.pointer._visible = true;  _root.flag = true;  _root.elas = false; } on (release, releaseOutside) {  Mouse.show();  _root.pointer._visible = false;  _root.flag = false;  _root.elas = true; }

10. Go back to the main timeline (i.e. scene1) and in the default keyframe, insert the action:

10.返回主时间轴(即scene1),然后在默认关键帧中插入操作:

//make the pointer invisible pointer._visible = false; flag = false; elas = false; //start width is width of movieclip startwidth = 100; //mvwidth is width of movie mvwidth = 400; function setwidth() {  if(flag) {    width = mvwidth - _xmouse    width = width + 100    rubber._width = width    iws = rubber._width  }  if(elas){    elastic += (startwidth - rubber._width);    elastic *= .4    rubber._width += elastic;  } } //this acts as a timer it calls the setwidth function   every 50 milli seconds setInterval(setwidth,50)

Finished! Now, test the movie!

完蛋了! 现在,测试电影!

翻译自: https://www.sitepoint.com/dragable-rubber-band-effect/

flash 调用 脚本

最新回复(0)