欧美久久天天综合香蕉伊,h片在线免费观看,九九欧美,欧美1区2区3区,日本在线不卡一区,国产视频久久久,91久久久久久久

2023信創(chuàng)獨(dú)角獸企業(yè)100強(qiáng)
全世界各行各業(yè)聯(lián)合起來,internet一定要實(shí)現(xiàn)!

Flash MX 2004新特性實(shí)例學(xué)習(xí)七

2004-02-12 eNet&Ciweek

  實(shí)例八、Trace Bitmap Panel

  一、涉及特性

  本實(shí)例不太復(fù)雜,主要涉及組件的應(yīng)用、對組件的編程和對JavaScript的應(yīng)用,都是Flash MX 2004中的新特性。

  二、制作過程

  1、從組件欄中拖四個Numeric Stepper到場景中,分別設(shè)置屬性如下:A、命名為start_stp,設(shè)置Maximum為10000,設(shè)置Minimum為1,step為1,value為100;B、命名為end_stp,設(shè)置Maximum為10000,設(shè)置Minimum為0,step為1,value為100;C、命名為color_stp,設(shè)置Maximum為100,設(shè)置Minimum為0,step為1,value為100;D、命名為area_stp,設(shè)置Maximum為500,設(shè)置Minimum為0,step為1,value為10。

  2、從組件欄中拖兩個Combo Box到場景中,分別設(shè)置屬性如下:A、命名為curve_cb,設(shè)置labels為“[normal, very tight, pixels, smooth, very smooth]”,設(shè)置rowCount為5;B、命名為corner_cb,設(shè)置labels為“[normal, many corners, few corners]”,設(shè)置rowCount為5。

  3、從組件欄中拖一個Button到場景中,命名為submit_btn,設(shè)置Labels為Submit。然后排列所有組件如圖1所示。

  

  4、在TimeLine中新建一個圖層,命名為Actions,在該層的Action面板中增加如下語句:

  

  /* Copyright 2003 Macromedia, Inc. All rights reserved.

  The following is Sample Code and is subject to all restrictions

  on such code as contained in the End User License Agreement

  accompanying this product.

  */

  function click() {

   var tab = " ";

   var asNewLine = "\n";

  //注釋1

   if (start_stp.value == "") {

   var startKF_as = "\"\"";

   } else {

   var startKF_as = start_stp.value;

   }

   if (end_stp.value == "") {

   var endKF_as = "\"\"";

   } else {

   var endKF_as = end_stp.value;

   }

   if (color_stp.value == "") {

   var threshold_as = "\"\"";

   } else {

   var threshold_as = color_stp.value;

   }

   if (area_stp.value == "") {

   var minArea_as = "\"\"";

   } else {

   var minArea_as = area_stp.value;

   }

   var curveFit_as = _root.curve_cb.value;

   var corner_as = _root.corner_cb.value;

   //注釋2

   var str = "var cur_tl = fl.getDocumentDOM().getTimeline();"+"var curFrame, startKF, endKF;"+"var newSel = new Array();"+"try {"+"startKF = eval("+startKF_as+"-1);"+"endKF = eval("+endKF_as+"-1);"+"var threshold = "+threshold_as+";"+"var minArea = "+minArea_as+";"+"var curveFit = \""+curveFit_as+"\";"+"var corner = \""+corner_as+"\";"+"var errorMessage = \"\";"+"function theErrorMessage(msg){"+"if (errorMessage == \"\"){"+"errorMessage = msg;"+"}"+"else{"+"errorMessage += \"\\n\"+msg;"+"};"+"};"+"var thresholdErrorCondition = threshold==\"\"    threshold < 1    threshold > 500;"+"var minAreaErrorCondition = minArea==\"\"    minArea > 1000    minArea < 1 ;"+"if(startKF <=-1    endKF==-1    thresholdErrorCondition    minAreaErrorCondition){"+"if(startKF == -1){"+"theErrorMessage(\"Please enter a start frame.\");"+"};"+"if(startKF < -1){"+"theErrorMessage(\"The start frame you specified does not exist.\");"+"};"+"if(endKF == -1){"+"theErrorMessage(\"Please enter an end frame.\");"+"};"+"if(endKF < -1){"+"theErrorMessage (\"The end frame you specified does not exist.\");"+"};"+"if(thresholdErrorCondition){"+"theErrorMessage (\"Please enter a value for Threshold between 1 - 500.\");"+"};"+"if( minAreaErrorCondition){"+"theErrorMessage (\"Please enter a value for Minimum Area between 1 - 1000.\");"+"};"+"alert(errorMessage);"+"}"+"else{"+"for (var k=0; k //注釋3

   MMExecute(str);

  }

  //注釋4

  submit_btn.addEventListener("click", this);

  注釋1:檢查各個組件的值,如果為空的話,則設(shè)置為“”。

    注釋2:構(gòu)造一個Java Script字符串。有興趣的話,可以找點(diǎn)相關(guān)的資料來看看,不會太難。(ActionScript 1.0跟JavaScript是非常像的。)

    注釋3:執(zhí)行生成的JavaScript字符串。

    注釋4:在Button組件submit_btn上面?zhèn)陕狘c(diǎn)擊事件。

  三、實(shí)際用途

  嚴(yán)格來說,本實(shí)例只能算是一個半成品,不過實(shí)例所提供的思路很有啟發(fā)性:怎么利用Numeric Stepper,怎么生成JavaScript字符串,怎么檢查組件的值,等等,都很值得我們學(xué)習(xí)。這在制作網(wǎng)頁表單,收集信息等場合中是非常有用的。

  

相關(guān)頻道: eNews

您對本文或本站有任何意見,請?jiān)谙路教峤唬x謝!

投稿信箱:tougao@enet16.com