jan_flanders

Untitled

Dec 11th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
  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.     }
  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.  
  31. //This is the code i have on frame 1 of the iTextBoxes movieclip
  32.  
  33. stop();
  34. var currentLetter:Number = 0;
  35. var writingInterval:Number;
  36.  
  37. function setText(currentMessage:String, textBox:TextField):void
  38. {
  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. }
Advertisement
Add Comment
Please, Sign In to add comment