Показать сообщение отдельно
Старый 01.09.2011, 22:32
Newred вне форума Посмотреть профиль Отправить личное сообщение для Newred Посетить домашнюю страницу Newred Найти все сообщения от Newred
  № 3  
Ответить с цитированием
Newred
 
Аватар для Newred

Регистрация: May 2010
Адрес: Киев, Украина
Сообщений: 140
Записей в блоге: 2
забирай)

Код AS3:
public function effText():void
		{
			frameTime = Math.round(textSpeed * 1 / this.stage.frameRate);
			charTimer = new Timer(frameTime);
 
			charTimer.addEventListener(TimerEvent.TIMER, charTimerComplete);
			charTimer.start();
 
			charTimerTarget = txt1;
			charTimerTargetSource = 'Bad decisions\ncatching up with you?';
			charTimerTargetData = charTimerTargetSource.split('');
			charTimerTargetCount = 0;
		}
 
 
		private function latensy():void
		{
			var latensyTimer = new Timer(1500,1); //задержка 1,5 секунды 
 
			latensyTimer.addEventListener(TimerEvent.TIMER, latensyTimerComplete);
			latensyTimer.start();
		}
 
		private function latensyTimerComplete(e:TimerEvent):void
		{
			 switch(messageCount)
				 {
					 case 0:
					 {
						 txt1.text = '';												 
						 charTimerTargetSource = 'Improve your driving skills\nwith traffic school... Online!';						 
						 charTimerTargetData = charTimerTargetSource.split('');
						 charTimerTargetCount = 0;						 
					 } break;
 
					 case 1:
					 {
						 txt1.text = '';
 
						 charTimerTargetSource = 'Clear your record at\nyour own convenience.';
						 charTimerTargetData = charTimerTargetSource.split('');
						 charTimerTargetCount = 0;						 
					 } break;
 
					 case 2:
					 {
						 txt1.text = '';
						 txt1.y = 15;
						 charTimerTargetSource = "Start your court-approved\ntraffic school\nbefore it s too late!";
						 charTimerTargetData = charTimerTargetSource.split('');
						 charTimerTargetCount = 0;
					 } break;
 
					 case 3:
					 {
						 charTimer.stop();
					 } break;
				 }
 
				 messageCount ++;
		}
 
		public function charTimerComplete(event:TimerEvent):void
		{
			if (charTimerTargetCount < charTimerTargetData.length)
			{
				charTimerTarget.appendText(charTimerTargetData[charTimerTargetCount]); 
				charTimerTargetCount ++;
			}else
			{
			switch(messageCount)
				 {
					 case 0: 
					 {
// то что нужно выполнить сразу перенеси сюда из latensyTimerComplete					 
					 } break;
 
					 case 1:
					 {
 
					 } break;
 
					 case 2:
					 {
 
					 } break;
 
					 case 3:
					 {
 
					 } break;
				 }
				latensy(); 
			}
}


Последний раз редактировалось Newred; 02.09.2011 в 03:47. Причина: } забыл скобку в конце функции