![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
With ActionScript, you can have Flash compare information and take action based on criteria you specify. In this example, you'll add ActionScript for Flash to take one action if the user enters no data in the text field, and a different action if the user does.
stop();
code. Press Enter or Return.//Adds conditional logic for the Submit button that validates user input
. Press Enter or Return.submit_btn
, and then type onRelease
. onRelease
, type = function (){}
in the Script pane.if (url_txt.text == null || url_txt.text == ""){
in the Script pane.
The parallel lines are equivalent to or in ActionScript.
gotoAndStop("error");
in the Script pane. Press Enter or Return. else{
in the Script pane. Press Enter or Return. gotoAndStop("confirm")
in the Script pane. Press Enter or Return, and type },
then press Enter or Return again and type };
.
Your script should appear as follows:
//Stops the playhead at frame 1 stop(); //Adds conditional logic for the Submit button that validates user input this.submit_btn.onRelease = function(){ if (url_txt.text == null || url_txt.text ==""){ gotoAndStop("error"); } else { gotoAndStop("confirm") } };
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |