Search code examples
actionscript-3textinputframegoto

AS3 input text goto frame for noob like me


Can someone pls help me on this. I had accident recently and forgot all of this. Now i want to work again on it...So..Thing is. I want some text field with submit button. When i input in text field certain number and clcik submit, then it takes me to corresponded frame when all the data regarding that number in input box will be. For example, i need to put number 100, and i dedicated frame 100 to that input, so user clcik submit and takes him to frame 100. Thank you very much I did find something like this

import flash.events.MouseEvent; 
submitbtn.addEventListener(MouseEvent.CLICK, testPassword); 

function testPassword(e:MouseEvent):void { 
if (numbertext.text == "903") { 
     gotoAndPlay(903);
} else { 
     gotoAndPlay(200);
  }
  }

Something like that


Solution

  • My solution:

    Pass number, not string to Number DataType.

    import flash.events.MouseEvent; 
    import flash.display.MovieClip
    
    var numbertext:Number = 0;
    var MyClip:MovieClip = new MovieClip();
    
    submitbtn.addEventListener(MouseEvent.CLICK, testPassword); 
    
    function testPassword(e:MouseEvent):void { 
        if (numbertext == 903) { 
             MyClip.gotoAndPlay(903);
        } 
        else { 
            MyClip.gotoAndPlay(200);
        }
    }
        
    

    Note if you add it to the frame use this.gotoAnPlay(number)

    To learn more about gotoAndPlay() visit ActionScript gotoAndPlay