2017-02-02 4 views
0

メインタイムが終わったら "time is up"ムービークリップを表示したい。3秒カウントダウンが終了したら特定のフレームに移動する。removeイベントリスナーを使用するが、すべてのリスナーとこれを行う簡単な方法はありますか?ステージを停止する簡単な方法はありますか?

import flash.net.SharedObject; 
import flash.utils.Timer; 
import flash.events.TimerEvent; 
import flash.events.TouchEvent; 
import flash.ui.Multitouch; 
import Turn; 
import ScoreHolder; 
  
timeisup.visible = false ; 
  
//This timer start when the main timer stop. 
var threesecond:Timer = new Timer(3000,0); 
  
////MAIN TIMER 
var minute:Number = 0; 
var second:Number = 15; 
  
//This timer check to timer and set to what happen if time over. 
var timercheck:Timer = new Timer(1000,0); 
timercheck.addEventListener(TimerEvent.TIMER, timercheck1); 
timercheck.start(); 
  
function timercheck1(evt:TimerEvent):void { 
if (minute <1 && second <1) 
{ 
timer.stop(); 
timeisup.visible = true; 
timeisup.play(); 
threesecond.start(); 
  
stage.removeEventListener(Event.ENTER_FRAME, h1); 
stage.removeEventListener(Event.ENTER_FRAME, h2); 
stage.removeEventListener(Event.ENTER_FRAME, h3); 
stage.removeEventListener(Event.ENTER_FRAME, h4); 
stage.removeEventListener(Event.ENTER_FRAME, h5); 

    } 
} 
  
////What gonna happen to when threesecond over 
threesecond.addEventListener(TimerEvent.TIMER, zamanbittia); 
  
function zamanbittia(evt:TimerEvent):void 
{ 
gotoAndPlay(392);  
} 
  
// Create the timer 
// Checks the clock function every 1000 milisecond (1 second) 
  
var timer:Timer = new Timer(1000); 
timer.addEventListener(TimerEvent.TIMER, clock); 
timer.start(); 
  
// Function that increments the timer 
function clock(evt:TimerEvent):void {  
// every time this function is checked increment second by one 
second -= 1; 
// If the second is 59 
if(second < 0){ 
// The minute will be plussed with 1 
minute -= 1; 
//and the zero will be set to 00 
second = 59; 
} 

はまた、私は

stage.frameRate = 0.01; 

を試みたが、それは遅くするだとオブジェクトに移動しながら、タイマーが停止した場合、私はエラーを取得します。

+0

あなたのやりたいことを正確にはわかりません。ネストされたムービークリップをすべて停止するには、単に次のようにします。 'stage.stopAllMovieClips();' – BadFeelingAboutThis

+0

ステージ上でボタンがランダムに動いています。私はそれらを停止しようとしています。 – KucuKeko

+0

あなたのボタンをどのように動かしているのかはっきりしていませんが、ここであなたのボタンはあなたが見せたものと何かのことをしています(例えば、すべてのENTER_FRAMEはイベントリスナーを削除します)。 – BadFeelingAboutThis

答えて

0

stop();あなたのメインスクリプトで ここにさまざまな実装例を見てくださいStop the main timeline from within a Class function

+0

私はメインスクリプトを使用していません。フレームコードが必要です。 – KucuKeko

+0

フレームコードはちょうどstop()です。 – quantomworks

+0

Stop();動いているボタンを止めることはできませんでした。 – KucuKeko

関連する問題