1 / 27

小提醒

小提醒. 記得複習 記得練習. 復習 – 第一堂課. 基本概念介紹、開發環境介紹 . 開發工具介紹 - Flash. 三大元件. 1. MovieClip , 2. Graphic, 3. Button 新增: Insert  New symbol 新增後元件將會在 library 中. 開啓 Actions 視窗. 什麼是 t race. trace (); 是在 flash 測試影片是“輸出信息 ” 若輸入 trace(“abc123”) 即可在 Output 中看到 abc123. 副檔名. . fla − 原始檔,可編輯

lamis
Télécharger la présentation

小提醒

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 小提醒 • 記得複習 • 記得練習

  2. 復習 – 第一堂課 基本概念介紹、開發環境介紹

  3. 開發工具介紹 - Flash

  4. 三大元件 • 1. MovieClip, 2. Graphic, 3. Button • 新增:Insert New symbol • 新增後元件將會在library中

  5. 開啓Actions視窗

  6. 什麼是trace • trace();是在flash測試影片是“輸出信息” • 若輸入trace(“abc123”)即可在Output中看到abc123

  7. 副檔名 • .fla−原始檔,可編輯 • .swf− Flash 製作出來的動畫檔,呈現結果

  8. 範例程式 • mybutton.addEventListener(MouseEvent.CLICK, buttonClicked) • function buttonClicked(event:Event):void { trace(“123”) }

  9. 小常識 • trace(“abc”) • 可用來註解一行// trace(“123”) • 註解一段 /* trace(“123”) trace(“456”) */ • 電腦閱讀程式語言: 上到下

  10. 第二堂課 資料形態與變數宣告

  11. 今天要學什麼 • 變數、資料形態(整數、數字、字串、布林值等) • 宣告變數 • 設定變數 • 使用變數 • 動態文字欄位 • 小任務

  12. Variable • variables 變數縮寫var • 變數是一種儲存數據或資料的載體。 a=3

  13. 資料形態 • int : 整數(integer) • Number : 任何數值,可以是整數或包含小數點的數值 • String : 文字(字串),例如人名 • Boolean : 布林值 (true 或 false)

  14. 如何宣告變數 • var變數名:資料形態 • 例如 varanInteger:int varaNumber:Number varaString:String varaBoolean:Boolean *不要以數字或特殊符號開頭(有例外,如”$”或”_”) *命名要有意義,寫程式比較容易 *同一個檔案裡面,名字不能重複

  15. 如何設定變數(給值) varanInteger:int; varaNumber:Number; varaString:String; varaBoolean:Boolean; anInteger = 23; aNumber = 8.9; aString = “test”; aBoolean = true;

  16. 宣告+設定變數 varanInteger:int = 2; varaNumber:Number= 8.9; varaString:String = “test”; varaBoolean:Boolean = true;

  17. 如何trace變數 varjordan:int = 23 trace(jordan) varmytext:String = “15” trace(mytext) 請試試看如果加雙引號 trace(“mytext”)

  18. 如何trace一連串變數 trace(anInteger, aNumber, aString, aBoolean)

  19. 小任務 • 下列程式碼: vara:int; a = 20; a = 30; a = 50; vari:int; i = 3.7; 執行完後,請trace出a和i

  20. 如何使用變數 varthelocation:int= 3 varmystring:String= “abc123” varifvisible:Boolean= true bluesquare.x = thelocation theinputtext.text = mystring greysquare.visible = ifvisible

  21. 為什麼要用變數?(1) square1.x = 20; square2.x = 20; square3.x = 20; … square1000.x = 20; 如果要把所有square的x坐標改到20….. 要改1000次

  22. 為什麼要用變數?(2) varthex:int = 20 square1.x = thex; square2.x = thex; square3.x = thex; … square1000.x = thex; 只需要更動第一行程式碼,將10改成20即可!

  23. 用Flash製作”動態文字”欄位 • 靜態文字欄位:顯示的文字固定,不能更動 • 動態文字欄位:可以用程式碼更改顯示的文字

  24. 如何將變數顯示 varanInteger:int= 15000 atext.text= String(a) VaraString:int = “hello” btext.text = aString

  25. 小任務 • 宣告兩個變數,資料形態為整數 • 第一個整數數值50,第二個為100 • 製作一個MovieClip • 將MovieClip拖曳到Stage(舞台)上 • 將MovieClip的 • x坐標設定為第一個整數的值 • y坐標設定為第二個整數的值 宣告變數 設定變數 使用變數

More Related