///pc/img/blank.gif" width="12" height="8" border="0">当前位置:///default.htm" class="under">亿度网络 -> ///pc/index.htm" class="under">网页制作教程 -> Flash实例


/pc/bin/msg.pl?file_id=k_flashjq53 target="_blank">///pc/img/message.gif" width="64" height="54" alt="请您留言" border="0">
谈谈您的看法

///pc/img/blank.gif" width="1" height="1" border="0">
53.求一元二次方程的根
预览成品: 在a、b、c文本框中输入a、b、c的值,点击计算按钮,即可在X1和X2文本框中输出方程的根,若无解,则显示“无解”字样。按清除按钮,则可清除所有文本框中值。

///pc/homepage/flashsl/flash53/swf/53.zip" target="_blank"> 下载源程序


逐步说明:
  我们先给出完整的程序,然后再逐一讲解:

///pc/homepage/flashsl/flash53/img/001.gif" width="446" height="316" alt="界面" border="0">

  1)界面上有五个文本框,从上到下,从左到右的变量名依次为:a、b、c、x1、x2,属性为:

///pc/homepage/flashsl/flash53/img/002.gif" width="351" height="304" alt="文本框属性" border="0">

  2)双击计算按钮,切换到Actions选项卡,里面的程序为:
On (Press, Key: )
 Set Variable: "determinant" = (b*b)-(4*a*c)
 If (determinant<0)
  Begin Tell Target ("wujie")
   Go to and Play (2)
  End Tell Target
 Else
  Set Variable: "n1" = 1
  Set Variable: "loop1" = 0
  Loop While (loop1<100)
   Set Variable: "n1" = n1-(n1*n1-determinant)/(2*n1)
   Set Variable: "loop1" = loop1+1
  End Loop
  Set Variable: "top" = -(b)+n1
  Set Variable: "finish" = top/(2*a)
  Set Variable: "x1" = finish
  Set Variable: "n2" = 1
  Set Variable: "loop2" = 0
  Loop While (loop2<100)
   Set Variable: "n2" = n2-(n2*n2-determinant)/(2*n2)
   Set Variable: "loop2" = loop2+1
  End Loop
  Set Variable: "top1" = -(b)-n2
  Set Variable: "finish1" = top1/(2*a)
  Set Variable: "x2" = finish1
 End If
End On
  表示如(b*b-4*ac)大于0,则计算两个根,并分别在X1和X2文本框中输出,如小于0,则从第2帧开始播放实体名称为“wujie”的电影。
  3)界面上的小圆圈即为实体名称为“wujie”的Movie Clip,用鼠标右键点击它,在弹出的菜单中选择Edit项,

///pc/homepage/flashsl/flash53/img/003.gif" width="168" height="240" alt="编辑菜散" border="0">

进入该Movie Clip编辑模式,该Movie Clip即为方程无解时,显示“无解”字样。
  4)点击等时线窗口左上角的///pc/homepage/flashsl/flash53/img/004.gif" width="73" height="25" align="absmiddle" border="0">按钮,切换到场景1,双击清除按钮,切换到Actions选项卡,里面的程序为:

///pc/homepage/flashsl/flash53/img/005.gif" width="437" height="159" alt="清除按钮" border="0">

  即把所有的文本框都清空。


上一实例(风吹文字特效)  下一实例(作向心运动的小球)
/pc/bin/msg.pl?file_id=k_flashjq53 target="_blank">
///pc/img/message.gif" width="64" height="54" alt="请您留言" border="0">

/pc/bin/msg.pl?file_id=k_flashjq53 target="_blank">谈谈您的看法

 

 

网页制作 网页设计 网站建设 网站设计 网站制作 做网站 做网页