MACROMEDIA FLASH 8-FLASH Specifications Page 251

  • Download
  • Add to my manuals
  • Print
  • Page
    / 290
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 250
Add conditional logic for the Submit button 251
Add conditional logic for the
Submit button
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 enter data.
1. Select Frame 1 of the Actions layer.
In the Script pane, place the insertion point after the
stop(); code.
Press Enter (Windows) or Return (Macintosh).
2. Type the following comment:
// Adds conditional logic for the Submit button that
// validates user input
.
Press Enter or Return.
3. In the Actions panel, click Insert a Target Path, located at the top of
the panel.
4. In the Insert Target Path dialog box, verify that Relative is selected.
Click submit_btn on the hierarchical tree, and click OK.
5. In the Script pane, type a period (.) after submit_btn, and then type
onRelease.
6. With the insertion point after onRelease, type = function (){} in
the Script pane.
7. Place the insertion point between the curly braces and press Enter or
Return, and then type
if (url_txt.text == null || url_txt.text
== ""){
in the Script pane.
The parallel lines are equivalent to logical or in ActionScript.
8. With the insertion point still inside the curly braces, press Enter or
Return.
9. Type gotoAndStop("error"); in the Script pane.
Press Enter or Return.
10. Place the insertion point after the curly brace and type else{ in the
Script pane.
Press Enter or Return.
Page view 250
1 2 ... 246 247 248 249 250 251 252 253 254 255 256 ... 289 290

Comments to this Manuals

No comments