1 / 6

設定 ActionScript

設定 ActionScript. 為實體命名 設定元件動作. 為實體命名. 本例自製滑鼠指標的 ActionScript 全都設在 拖鞋 元件之實體上 , 因此在本範例中 , 只要使用相對路徑來指定程式的作用目標 ( 請參考 20-5 的說明 ), 則即使不為該實體命名 , 也能順利製作出自製滑鼠。但為了替第 24 章範例中的後續程式做暖身 , 我們還是先將 拖鞋 元件之實體命名為 mouse_mc 。. 為實體命名. 設定元件動作. 在拖鞋 元件按右鍵,選 『 動作 』 進入動作面板,然後放入下面指令。. onClipEvent (load) {

Télécharger la présentation

設定 ActionScript

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. 設定 ActionScript • 為實體命名 • 設定元件動作

  2. 為實體命名 • 本例自製滑鼠指標的 ActionScript 全都設在拖鞋元件之實體上, 因此在本範例中, 只要使用相對路徑來指定程式的作用目標 (請參考 20-5 的說明), 則即使不為該實體命名, 也能順利製作出自製滑鼠。但為了替第 24章範例中的後續程式做暖身, 我們還是先將拖鞋元件之實體命名為 mouse_mc。

  3. 為實體命名

  4. 設定元件動作 • 在拖鞋元件按右鍵,選『動作』進入動作面板,然後放入下面指令。 onClipEvent (load) { // 自製滑鼠指標載入後才隱藏滑鼠指標 Mouse.hide(); // 將自製滑鼠指標 mouse_mc 移到深度 1000 處 this.swapDepths(1000); } onClipEvent (mouseMove) { // 移動滑鼠時, 讓自製滑鼠指標保持在滑鼠座標位置處 this._x = _root._xmouse; this._y = _root._ymouse; // 時時更新自製滑鼠指標位置 updateAfterEvent(); }

  5. 設定元件動作 • 最基本的自製滑鼠指標就這樣完成了!請按下 [Ctrl] + [Enter] 鍵來測試一下影片。另外我們還在練習檔中多準備了 1 個手的影片片段元件, 供你當做滑鼠指標來練習, 可在元件庫中找到。

  6. 設定元件動作

More Related