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
| |
| 6 | if (activeFrame <= numFrames) {
| |
| 7 | iControler.iPlayPause.gotoAndStop(1); | |
| 8 | activeFrame ++; | |
| 9 | gotoAndStop(activeFrame); | |
| 10 | iTextBoxes.gotoAndStop(activeFrame); | |
| 11 | isPaused = false; | |
| 12 | playAll(); | |
| 13 | } | |
| 14 | } | |
| 15 | function controlBack(event:MouseEvent):void { //Go to previous frame
| |
| 16 | if (activeFrame >= 2) {
| |
| 17 | iControler.iPlayPause.gotoAndStop(1); | |
| 18 | activeFrame --; | |
| 19 | gotoAndStop(activeFrame); | |
| 20 | iTextBoxes.gotoAndStop(activeFrame); | |
| 21 | isPaused = false; | |
| 22 | playAll(); | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | //This is the code i have on frame 1 of the iTextBoxes movieclip | |
| 27 | ||
| 28 | stop(); | |
| 29 | var currentLetter:Number = 0; | |
| 30 | function setText(currentMessage:String, textBox:TextField):void {
| |
| 31 | var writingInterval:Number = setInterval(autoWrite, 100); | |
| 32 | function autoWrite():void {
| |
| 33 | if (currentLetter <= currentMessage.length) {
| |
| 34 | textBox.text = currentMessage.substr(0, currentLetter) + "█"; | |
| 35 | currentLetter ++; | |
| 36 | } else {
| |
| 37 | clearInterval(writingInterval); | |
| 38 | gotoAndStop(nextFrame); | |
| 39 | } | |
| 40 | } | |
| 41 | } |