View difference between Paste ID: DFwsuXj2 and X6DyHQGZ
SHOW: | | - or go back to the newest paste.
1
//Here i'm setting the buttons that move between frames.
2
//When i add iTextBoxes.gotoAndStop(activeFrame); it errors.
3
//I want the textbox movieclip frames to switch sync to the main frames.
4
5-
function controlNext(event:MouseEvent):void { //Go to next frame
5+
function controlNext(event:MouseEvent):void
6-
	if (activeFrame <= numFrames) {
6+
 {
7
	if (activeFrame <= numFrames) 
8
	{
9
		iControler.iPlayPause.gotoAndStop(1);
10
		activeFrame ++;
11
		gotoAndStop(activeFrame);
12
		iTextBoxes.gotoAndStop(activeFrame);
13
		isPaused = false;
14
		playAll();
15-
function controlBack(event:MouseEvent):void { //Go to previous frame
15+
16-
	if (activeFrame >= 2) {
16+
17
18
function controlBack(event:MouseEvent):void
19
{
20
	if (activeFrame >= 2) 
21
	{
22
		iControler.iPlayPause.gotoAndStop(1);
23
		activeFrame --;
24
		gotoAndStop(activeFrame);
25
		iTextBoxes.gotoAndStop(activeFrame);
26
		isPaused = false;
27
		playAll();
28
	}
29
}
30-
function setText(currentMessage:String, textBox:TextField):void {
30+
31-
	var writingInterval:Number = setInterval(autoWrite, 100);
31+
32-
	function autoWrite():void {
32+
33-
		if (currentLetter <= currentMessage.length) {
33+
34-
			textBox.text = currentMessage.substr(0, currentLetter) + "█";
34+
35-
			currentLetter ++;
35+
var writingInterval:Number;
36-
		} else {
36+
37-
			clearInterval(writingInterval);
37+
function setText(currentMessage:String, textBox:TextField):void 
38-
			gotoAndStop(nextFrame);
38+
{
39-
		}
39+
	writingInterval = setInterval(autoWrite, 100);
40
}
41
42
function autoWrite():void 
43
{
44
	if (currentLetter <= currentMessage.length) 
45
	{
46
		textBox.text = currentMessage.substr(0, currentLetter) + "█";
47
		currentLetter ++;
48
	} 
49
	else 
50
	{
51
		clearInterval(writingInterval);
52
		gotoAndStop(nextFrame);
53
	}
54
}