# Back, Then No Forward

**URL:** <https://forum.kirupa.com/t/back-then-no-forward/319834>\
**Category:** flash\
**Created:** [March 6, 2011, 4:10am UTC](https://forum.kirupa.com/t/back-then-no-forward/319834 "2011-03-06T04:10:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlashAj325](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@FlashAj325](https://forum.kirupa.com/u/FlashAj325)\
**Post date:** [March 6, 2011, 4:10am UTC](https://forum.kirupa.com/t/back-then-no-forward/319834/1 "2011-03-06T04:10:50Z")

</div>

[FONT=Courier New]I have been working on a tutorial in Flash on the topic of Flash (:lol:) for two days, and I am just finishing up on a template. I have fixed five bugs, but I cannot think of how to fix this last one. I’d rather actually \*\*\*fix \*\*\*the problem this time, instead of improvising :puzzle:. So, here is what is going on:[/FONT]

[FONT=Courier New]I have this thing at the end where you have to enter in the code that I taught the viewer to proceed, then hit the continue button to finish the tutorial. But for some reason, whenever I try to go back with the back arrow, it does, but then I can’t go forward with the forward arrow until I reach the first frame that contains actual tutorial (“page” 2). Then it works again. It seems really random, but there is [obviously] a **good** explanation for it. I thought it might have something to do with the fact that \*\*all of the arrows up to the “test” part, excluding the back arrow there, \*have the exact same instance name. \*\*\*However, “page” 2 is the 2nd time it is used (introduction, then the “page” 2, then 3, 4, 5, and 6, then the test part thing), so it makes less sense that it would work the 2nd time, but not the third, fourth, fifth, or sixth. And I know there’s nothing wrong with the code itself:[/FONT]

stop();  
backArrowA\_btn.addEventListener(MouseEvent.CLICK, goBack);  
contArrowA\_btn.addEventListener(MouseEvent.CLICK, goForward);  
function goBack(event:MouseEvent):void{  
prevFrame();  
}  
function goForward(event:MouseEvent):void{  
nextFrame();  
}

[FONT=Courier New]-contArrowA\_btn is the continue arrow[/FONT]  
[FONT=Courier New]-backArrowA\_btn is the back arrow[/FONT]

[FONT=Courier New]So here is all of the code that may be relevant, with explanations:[/FONT]

stop();  
play\_btn.addEventListener(MouseEvent.CLICK, beginTutorial);  
function beginTutorial(event:MouseEvent):void{  
gotoAndStop(3);  
}

[FONT=Courier New]-play\_btn begins the tutorial (like a forward arrow, but it looks like a button, not an arrow)[/FONT]

var contArrowBUnlock = 0;  
enter\_btn.addEventListener(MouseEvent.CLICK, checkText);  
specs\_btn.addEventListener(MouseEvent.CLICK, viewSpecs);  
function checkText(event:MouseEvent):void  
{  
var reqText:String = codeTest\_inptTxt.text;  
var importantNum = reqText.indexOf(typeThis.text);

if(importantNum \>= 0)  
{  
trace(“Win”);  
contArrowBUnlock = 1;  
}  
else  
{  
trace(“Fail”);  
trace("What you were supposed to type: " + typeThis.text);  
trace("What you actually typed: " + reqText);  
}  
}  
function viewSpecs(event:MouseEvent):void  
{  
specs\_mc.play();  
}  
enter\_btn.addEventListener(MouseEvent.CLICK, checkForWin);  
function checkForWin(event:MouseEvent):void  
{  
if (contArrowBUnlock == 1) {  
var newFwdArrow = new forwardArrow();  
newFwdArrow.height = 75.75;  
newFwdArrow.width = 79.65;  
newFwdArrow.x = 465;  
newFwdArrow.y = 340;  
newFwdArrow.instanceName = contArrowA\_btn;  
addChild(newFwdArrow);  
removeChild(contArrowB\_btn);  
removeChild(backArrowA\_btn);  
setChildIndex(specs\_mc,numChildren - 1);  
setChildIndex(leaveMovie\_mc,numChildren - 1);  
newFwdArrow.addEventListener(MouseEvent.CLICK, endTutorial);  
}  
}  
function endTutorial(event:MouseEvent):void{  
gotoAndStop(10);  
}

[FONT=Courier New]Okay, a lot, but here we go:[/FONT]  
[FONT=Courier New]-codeTest\_inptTxt is the input textfield in which you must type the code in and enter it in(see below) to go to the next frame[/FONT]  
[FONT=Courier New]-enter\_btn is a button to check the text found in codeTest\_inptTxt[/FONT]  
[FONT=Courier New]-specs\_btn is a button to view specs\_mc[/FONT]  
[FONT=Courier New]-specs\_mc is a movie clip that comes out of the side of the stage when specs\_btn is clicked to help the reader know how to type what he/she needs to put in codeTest\_inptTxt[/FONT]  
[FONT=Courier New]-typeThis is a textbox out of view linked to ActionScript with the needed code to pass the test inside it. I used it because the script needed to type in to pass the test was multi-line[/FONT]  
[FONT=Courier New]-forwardArrow is the export name for the contArrowA\_btn’s actual object, Forward Arrow (contArrowA\_btn being the instance name)[/FONT]  
[FONT=Courier New]-contArrowB\_btn is the forward arrow shown during the test (it has a lock on it) that goes away and gets replaced by a newChild of a forwardArrow(that lets the person go on once they pass)[/FONT]  
[FONT=Courier New]-leaveMovie\_mc is a screen that pops up if your mouse leaves the stage[/FONT]

[FONT=Courier New]Sorry that this is so long. I just wanted to explain the situation. Thanks.[/FONT]  
[FONT=Courier New][/FONT]

[FONT=Courier New]-FlashAj325[/FONT]
