Цитата:
Сообщение от Newred
забирай)
Код 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();
}
|
Все сделал, как вы и написали, а флеш выдает ошибку
Код AS3:
C:\Users\Armen\Desktop\b\Main.as, Line 344 1013: The private attribute may be used only on class property definitions.
Добавлено через 9 минут
Цитата:
Сообщение от Newred
забирай)
|
Вы имели в виду так?
Код AS3:
private 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(event: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 ++;
}
private function charTimerComplete(event:TimerEvent):void
{
if (charTimerTargetCount < charTimerTargetData.length)
{
charTimerTarget.appendText(charTimerTargetData[charTimerTargetCount]);
charTimerTargetCount ++;
}else
{
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;
}
latensy();
}
}
Ошибок сейчас нет, но получается какая-то ерунда