本週進度:
- 偵聽與廣播(事件偵聽程式)
簡單來說就是:
廣播者物件.addEventListener(事件類型,偵聽者function);
- 基本影片操控指令(控制影片片段播放作業)
這裡有完整的MovieClip指令與範例說明
所以今天的作業是:
相~片~播~放~器~
是的,請使用本次教的東西發揮創意囉^^
- 請使用影片的ActionScript操控指令
- 使用滑鼠點擊按鈕Click動作(當然如果要用特別的也可以)
本次的AS
stop();//先停住影格 mynext.addEventListener(MouseEvent.CLICK,nextphoto);//偵聽滑鼠點next的動作 mynext.buttonMode=true;//啟動滑鼠的按鈕手勢模式 function nextphoto(event:MouseEvent) { if (currentFrame==totalFrames) {//如果現在的影格是最後一格 gotoAndStop(1);//讓影片跑到第一格並停下來 } else { nextFrame();//下一個影格 } } mypre.addEventListener(MouseEvent.CLICK,prephoto); mypre.buttonMode=true; function prephoto(event:MouseEvent) { if (currentFrame==1) {//如果現在的影格是第一格 gotoAndStop(totalFrames);//讓影片跳到最後一格並停下來 } else { prevFrame();//往前一個影格 } } /*下方縮圖按鈕動作,點選跳到該影格的設定*/ btn01.buttonMode=true; this.btn01.addEventListener(MouseEvent.CLICK,photo01); function photo01(event:MouseEvent) { gotoAndStop(1); } btn02.buttonMode=true; this.btn02.addEventListener(MouseEvent.CLICK,photo02); function photo02(event:MouseEvent) { gotoAndStop(2); } btn03.buttonMode=true; this.btn03.addEventListener(MouseEvent.CLICK,photo03); function photo03(event:MouseEvent) { gotoAndStop(3); } btn04.buttonMode=true; this.btn04.addEventListener(MouseEvent.CLICK,photo04); function photo04(event:MouseEvent) { gotoAndStop(4); } btn05.buttonMode=true; this.btn05.addEventListener(MouseEvent.CLICK,photo05); function photo05(event:MouseEvent) { gotoAndStop(5); }
當然也有原始檔給大家做參考囉~
大家加油
沒有留言:
張貼留言