[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]