李永升 牛強(qiáng)
摘要:Flash是一種動(dòng)畫創(chuàng)作與應(yīng)用程序開(kāi)發(fā)于一身的創(chuàng)作軟件,它有良好的交互性,利用它可制作大學(xué)物理實(shí)驗(yàn)仿真課件。該文所述的是用它來(lái)制作“分光計(jì)的調(diào)整與使用”實(shí)驗(yàn)的數(shù)據(jù)輸出課件方法。
關(guān)鍵詞:分光計(jì)的調(diào)整與作用;falsh;實(shí)驗(yàn)數(shù)據(jù)輸出
中圖分類號(hào):G642 文獻(xiàn)標(biāo)識(shí)碼:A 文章編號(hào):1009-3044(2014)17-3972-04
1 實(shí)驗(yàn)中的相關(guān)量
頂角A取60度;由計(jì)算折射率的公式[n=sinδmin+A2sinA2]可知最小偏向角因折射率不同而不同,計(jì)算公式:[δmin=2arcsinnsinA2-A]。
2 制作目標(biāo)
進(jìn)入課件后顯示的界面如圖1所示。界面上方有兩個(gè)表格,分別用來(lái)存放有關(guān)頂角的數(shù)據(jù)和有關(guān)最小偏向角的數(shù)據(jù)。在界面的下方有一個(gè)按鈕,每點(diǎn)擊它一次就在上面兩個(gè)表格中輸出一組實(shí)驗(yàn)數(shù)據(jù),不同組數(shù)據(jù)一般是不同的。
3 制作過(guò)程
3.1創(chuàng)建文件
運(yùn)行flash cs3,創(chuàng)建flash文件(actionScript3.0)。
3.2設(shè)置文檔屬性
將舞臺(tái)寬度改為800像素,高度改為620像素。
3.3制件影片剪輯元件
1) 制作名為“數(shù)據(jù)格式”的影片剪輯,在它內(nèi)建立兩個(gè)動(dòng)態(tài)文本框,它的實(shí)例名為“dushu”和“feishu”,在它們內(nèi)部輸入300和88,以便確定它們的大小適當(dāng)。在它的屬性“鏈接”中設(shè)置它的類名為“shujugeshi”。
2) 制作名為“數(shù)據(jù)表”的影片剪輯。如圖3所示,在它上制作如圖所示的表格,在表格上添加靜態(tài)文本;在它的上方添加一動(dòng)態(tài)文本,動(dòng)態(tài)文本的實(shí)例名為“biaotou”,它內(nèi)的文本為“表4 測(cè)定頂角的數(shù)據(jù)表格”。表格每行的高度為36像素,第一列寬為90像素,最后一列寬為108像素,其余各列寬為72像素。
3) 在舞臺(tái)上放置“數(shù)據(jù)表”的影片剪輯的兩個(gè)實(shí)例,實(shí)例名為“shujubiao1”和“shujubiao2”。
3.4編輯腳本文件
1) 更改表頭文本框中文本
shujubiao1.biaotou.text="表5.6-1 測(cè)定頂角的數(shù)據(jù)表格";
shujubiao2.biaotou.text="表5.6-2 測(cè)定最小偏向角的數(shù)據(jù)表格";
2) 創(chuàng)建兩個(gè)數(shù)組并復(fù)值
把數(shù)組中的每一個(gè)元素都復(fù)值為“數(shù)據(jù)格式”影片剪輯的一個(gè)實(shí)例,并把它們添加到標(biāo)題為“表5.6-1 測(cè)定頂角的數(shù)據(jù)表格”和“5.6-2 測(cè)定最小偏向角的數(shù)據(jù)表格”的數(shù)據(jù)表中。
var array1:Array=new Array();
for (var i:int = 0; i < 24; i++) {
array1[i] =new shujugeshi();
array1[i].y=86+Math.floor(i/6)*36;
array1[i].x=94+i%6*72;
shujubiao1.addChild(array1[i]);}
var array2:Array=new Array();
for (var k:int = 0; k < 24; k++) {
array2[k] =new shujugeshi();
array2[k].y=86+Math.floor(k/6)*36;
array2[k].x=94+k%6*72;
shujubiao2.addChild(array2[k]);}
3)制作和設(shè)置按鈕并為它設(shè)置事件
import fl.controls.Button;
var shujushengchang:Button=new Button();
shujushengchang.move(300,560)
shujushengchang.label="數(shù)據(jù)輸出";
shujushengchang.setSize(150,40);
addChild(shujushengchang);
var myFormat:TextFormat = new TextFormat("SIMHEI",25,0x000000,true);
shujushengchang.setStyle("textFormat", myFormat);
shujushengchang.addEventListener(MouseEvent.CLICK,fuzhishuju)
4)設(shè)計(jì)函數(shù)
A.用于選擇折射率的函數(shù)
實(shí)驗(yàn)中用的三棱鏡的折射率有多種,下面的腳本語(yǔ)言用于隨機(jī)產(chǎn)生一種折射率。
var zheshelu:Number;
function zhesheluxuanze(){
var mm:int=Math.floor(Math.random()*3.98);
if(mm==0){zheshelu=1.5153};
if(mm==1){zheshelu=1.6152};
if(mm==2){zheshelu=1.6085};
if(mm==3){zheshelu=1.7515};}
B.計(jì)算偏向角的函數(shù)
用于在給定參數(shù)折射率的情況下計(jì)算最小偏向角。
function pianxiangjiao(x:Number):Number{endprint
var min:Number=2*Math.asin(x*Math.sin(Math.PI/6))-Math.PI/3;
return (min+0.00029*(Math.random()*8-4))*180/Math.PI;}
C.頂角復(fù)值函數(shù)
輸出一個(gè)在一定范圍內(nèi)的頂角的值。
function dingjisofuzhi(){
var dingjiao:Number=(Math.PI/3+0.00029*(Math.random()*8-4))/Math.PI*180;
return(dingjiao)}
D.按鈕的事件響應(yīng)函數(shù)
用于給表中各元素復(fù)值。
function fuzhishuju(e:MouseEvent){
//頂角復(fù)值
var temp1=Math.random()*360;
var temp:Number;
shuzufuzhi(0,6,temp1)
var temp2:Number=temp1+180;
shuzufuzhi(6,12,temp2);
var temp3=temp1+2*dingjisofuzhi();
shuzufuzhi(12,18,temp3);
var temp4=temp3+180;
shuzufuzhi(18,24,temp4)
//最小偏向角復(fù)值
zhesheluxuanze();
var temp5=pianxiangjiao(zheshelu);
temp1=Math.random()*360;
shuzufuzhi2(0,6,temp1)
temp2=temp1+180;
shuzufuzhi2(6,12,temp2)
temp3=temp1+temp5;
shuzufuzhi2(12,18,temp3)
temp4=temp3+180;
shuzufuzhi2(18,24,temp4)}
E.對(duì)數(shù)組中的用來(lái)顯示頂角數(shù)值的元素復(fù)值函數(shù)。
function shuzufuzhi(x:int,y:int,z:Number){
var temp:Number;
for (var i:int = x; i < y; i++){
temp=z+0.15*(Math.random()-0.5);
if(temp>=360){
temp=temp-360;}
array1[i].dushu.text=Math.floor(temp);
array1[i].feishu.text=Math.round((temp-Math.floor(temp))*60);
//用于消除60分的情況。
if(Math.round((temp-Math.floor(temp))*60)==60){
array1[i].dushu.text=Math.floor(temp+1);
array1[i].feishu.text=0;}}}
F.對(duì)數(shù)組中的用來(lái)顯示頂角數(shù)值的元素復(fù)值函數(shù)。
function shuzufuzhi2(x:int,y:int,z:Number){
var temp:Number;
for (var i:int = x; i < y; i++){
temp=z+0.15*(Math.random()-0.5);
if(temp>=360){
temp=temp-360;}
array2[i].dushu.text=Math.floor(temp);
array2[i].feishu.text=Math.round((temp-Math.floor(temp))*60);
//用于消除60分的情況。
if(Math.round((temp-Math.floor(temp))*60)==60){
array2[i].dushu.text=Math.floor(temp+1);
array2[i].feishu.text=0;}}}
F.進(jìn)入課件后就對(duì)兩表中元素進(jìn)行一次復(fù)值
fuzhishuju(null)
3.5 課件輸出
點(diǎn)擊文件下拉菜單中的發(fā)布即可輸出實(shí)驗(yàn)課件。
4 結(jié)束語(yǔ)
本課件是大學(xué)物理實(shí)驗(yàn)課的一個(gè)補(bǔ)充,在一些特別的情況下可為進(jìn)行實(shí)驗(yàn)的學(xué)生提供實(shí)驗(yàn)“分光計(jì)的調(diào)整及使用”實(shí)驗(yàn)的實(shí)驗(yàn)數(shù)據(jù),為學(xué)生能進(jìn)一步書實(shí)驗(yàn)報(bào)告提供便利。
參考文獻(xiàn):
[1] 楊延欣,趙春華.大學(xué)物理實(shí)驗(yàn)[M].北京:科學(xué)出版社,2011:189-198.
[2] 程守洙,江之永.普通物理學(xué)[M].北京:高等教育出版社,1998:167-168.endprint
var min:Number=2*Math.asin(x*Math.sin(Math.PI/6))-Math.PI/3;
return (min+0.00029*(Math.random()*8-4))*180/Math.PI;}
C.頂角復(fù)值函數(shù)
輸出一個(gè)在一定范圍內(nèi)的頂角的值。
function dingjisofuzhi(){
var dingjiao:Number=(Math.PI/3+0.00029*(Math.random()*8-4))/Math.PI*180;
return(dingjiao)}
D.按鈕的事件響應(yīng)函數(shù)
用于給表中各元素復(fù)值。
function fuzhishuju(e:MouseEvent){
//頂角復(fù)值
var temp1=Math.random()*360;
var temp:Number;
shuzufuzhi(0,6,temp1)
var temp2:Number=temp1+180;
shuzufuzhi(6,12,temp2);
var temp3=temp1+2*dingjisofuzhi();
shuzufuzhi(12,18,temp3);
var temp4=temp3+180;
shuzufuzhi(18,24,temp4)
//最小偏向角復(fù)值
zhesheluxuanze();
var temp5=pianxiangjiao(zheshelu);
temp1=Math.random()*360;
shuzufuzhi2(0,6,temp1)
temp2=temp1+180;
shuzufuzhi2(6,12,temp2)
temp3=temp1+temp5;
shuzufuzhi2(12,18,temp3)
temp4=temp3+180;
shuzufuzhi2(18,24,temp4)}
E.對(duì)數(shù)組中的用來(lái)顯示頂角數(shù)值的元素復(fù)值函數(shù)。
function shuzufuzhi(x:int,y:int,z:Number){
var temp:Number;
for (var i:int = x; i < y; i++){
temp=z+0.15*(Math.random()-0.5);
if(temp>=360){
temp=temp-360;}
array1[i].dushu.text=Math.floor(temp);
array1[i].feishu.text=Math.round((temp-Math.floor(temp))*60);
//用于消除60分的情況。
if(Math.round((temp-Math.floor(temp))*60)==60){
array1[i].dushu.text=Math.floor(temp+1);
array1[i].feishu.text=0;}}}
F.對(duì)數(shù)組中的用來(lái)顯示頂角數(shù)值的元素復(fù)值函數(shù)。
function shuzufuzhi2(x:int,y:int,z:Number){
var temp:Number;
for (var i:int = x; i < y; i++){
temp=z+0.15*(Math.random()-0.5);
if(temp>=360){
temp=temp-360;}
array2[i].dushu.text=Math.floor(temp);
array2[i].feishu.text=Math.round((temp-Math.floor(temp))*60);
//用于消除60分的情況。
if(Math.round((temp-Math.floor(temp))*60)==60){
array2[i].dushu.text=Math.floor(temp+1);
array2[i].feishu.text=0;}}}
F.進(jìn)入課件后就對(duì)兩表中元素進(jìn)行一次復(fù)值
fuzhishuju(null)
3.5 課件輸出
點(diǎn)擊文件下拉菜單中的發(fā)布即可輸出實(shí)驗(yàn)課件。
4 結(jié)束語(yǔ)
本課件是大學(xué)物理實(shí)驗(yàn)課的一個(gè)補(bǔ)充,在一些特別的情況下可為進(jìn)行實(shí)驗(yàn)的學(xué)生提供實(shí)驗(yàn)“分光計(jì)的調(diào)整及使用”實(shí)驗(yàn)的實(shí)驗(yàn)數(shù)據(jù),為學(xué)生能進(jìn)一步書實(shí)驗(yàn)報(bào)告提供便利。
參考文獻(xiàn):
[1] 楊延欣,趙春華.大學(xué)物理實(shí)驗(yàn)[M].北京:科學(xué)出版社,2011:189-198.
[2] 程守洙,江之永.普通物理學(xué)[M].北京:高等教育出版社,1998:167-168.endprint
var min:Number=2*Math.asin(x*Math.sin(Math.PI/6))-Math.PI/3;
return (min+0.00029*(Math.random()*8-4))*180/Math.PI;}
C.頂角復(fù)值函數(shù)
輸出一個(gè)在一定范圍內(nèi)的頂角的值。
function dingjisofuzhi(){
var dingjiao:Number=(Math.PI/3+0.00029*(Math.random()*8-4))/Math.PI*180;
return(dingjiao)}
D.按鈕的事件響應(yīng)函數(shù)
用于給表中各元素復(fù)值。
function fuzhishuju(e:MouseEvent){
//頂角復(fù)值
var temp1=Math.random()*360;
var temp:Number;
shuzufuzhi(0,6,temp1)
var temp2:Number=temp1+180;
shuzufuzhi(6,12,temp2);
var temp3=temp1+2*dingjisofuzhi();
shuzufuzhi(12,18,temp3);
var temp4=temp3+180;
shuzufuzhi(18,24,temp4)
//最小偏向角復(fù)值
zhesheluxuanze();
var temp5=pianxiangjiao(zheshelu);
temp1=Math.random()*360;
shuzufuzhi2(0,6,temp1)
temp2=temp1+180;
shuzufuzhi2(6,12,temp2)
temp3=temp1+temp5;
shuzufuzhi2(12,18,temp3)
temp4=temp3+180;
shuzufuzhi2(18,24,temp4)}
E.對(duì)數(shù)組中的用來(lái)顯示頂角數(shù)值的元素復(fù)值函數(shù)。
function shuzufuzhi(x:int,y:int,z:Number){
var temp:Number;
for (var i:int = x; i < y; i++){
temp=z+0.15*(Math.random()-0.5);
if(temp>=360){
temp=temp-360;}
array1[i].dushu.text=Math.floor(temp);
array1[i].feishu.text=Math.round((temp-Math.floor(temp))*60);
//用于消除60分的情況。
if(Math.round((temp-Math.floor(temp))*60)==60){
array1[i].dushu.text=Math.floor(temp+1);
array1[i].feishu.text=0;}}}
F.對(duì)數(shù)組中的用來(lái)顯示頂角數(shù)值的元素復(fù)值函數(shù)。
function shuzufuzhi2(x:int,y:int,z:Number){
var temp:Number;
for (var i:int = x; i < y; i++){
temp=z+0.15*(Math.random()-0.5);
if(temp>=360){
temp=temp-360;}
array2[i].dushu.text=Math.floor(temp);
array2[i].feishu.text=Math.round((temp-Math.floor(temp))*60);
//用于消除60分的情況。
if(Math.round((temp-Math.floor(temp))*60)==60){
array2[i].dushu.text=Math.floor(temp+1);
array2[i].feishu.text=0;}}}
F.進(jìn)入課件后就對(duì)兩表中元素進(jìn)行一次復(fù)值
fuzhishuju(null)
3.5 課件輸出
點(diǎn)擊文件下拉菜單中的發(fā)布即可輸出實(shí)驗(yàn)課件。
4 結(jié)束語(yǔ)
本課件是大學(xué)物理實(shí)驗(yàn)課的一個(gè)補(bǔ)充,在一些特別的情況下可為進(jìn)行實(shí)驗(yàn)的學(xué)生提供實(shí)驗(yàn)“分光計(jì)的調(diào)整及使用”實(shí)驗(yàn)的實(shí)驗(yàn)數(shù)據(jù),為學(xué)生能進(jìn)一步書實(shí)驗(yàn)報(bào)告提供便利。
參考文獻(xiàn):
[1] 楊延欣,趙春華.大學(xué)物理實(shí)驗(yàn)[M].北京:科學(xué)出版社,2011:189-198.
[2] 程守洙,江之永.普通物理學(xué)[M].北京:高等教育出版社,1998:167-168.endprint