In this section, we create a Flash form that submits user-entered information to a server-side CGI script, which e-mails the data to an e-mail address that we specify with a Flash variable. By accessing a remote Perl CGI script, you make a Flash movie with five data exchange states: input, send, wait, output, and error. You learn how to submit name/value pairs from Flash to remote URLs, and learn how to check the receipt of variables from the CGI script using a multiple frame loop. We also use the new onClipEvent(data) action to detect the loading of the external variable data.
Flash forms are user data entry forms (just like HTML forms) that are created in Flash using Input Text fields. When a user types information in these text fields, the information is stored as variables. The values of these variables are then sent to a specified Web server using standard GET or POST communication. These same variables are available to the Web server and can be processed there by a CGI program or script. CGI programs can be written to e-mail this information, manipulate it, store it in a database, or perform many other applications. The same CGI script can also return values to Flash these can then be displayed or used by the originating Flash movie.
In this exercise, our Flash form solicits feedback from visitors, giving them an opportunity to submit comments, report bugs, or make suggestions for improvement. As each form is submitted, it’s e-mailed directly to the e-mail address you specify in the Flash movie.
These text fields accept input from your site visitors.
The serverTime field displays the time that the server received the Flash form data.
These actions need to put on the appropriate Flash event handlers. We start by defining our e-mail address variable, and then adding a Button instance to the input state. This Button instance uses a loadVariables action to send the data from the Flash movie tothe receiving script on our Web server. Then our wait state uses an if. . .else action to determine whether the server has received the data.
This code establishes the recipient’s e-mail address (your e-mail address) and the subject line of the e-mail, and issues a loadVariables action that sends the mailto, name, email, and comments variables to the sendmail.cgi script on our Web server. _root indicates that any output from the sendmail.cgi script should be directed to the Main Timeline of our movie. Depending on the browsers of your target audience, you may want to use the GET method for loadVariables, as Internet Explorer 4.5 (or earlier) on the Mac does not support the POST method from plug-ins.
After the loadVariables action is executed, a new variable called sendTime marks the time that the loadVariables action occurred. The getTimer() function is a built-in Flash function that returns the current time, in milliseconds, of Flash movie playback. Thus, if the user clicked the Button instance after spending 2 minutes to fill in the form, the getTimer() will return a value of around 60,000 (milliseconds). Finally, the gotoAndPlay action will direct the Main Timeline playback to the wait label.
This code first tests whether a variable called success has been received by the Flash movie (from the CGI script). If success exists and it’s equal to the string “1”*, then the Main Timeline will go to the output label. If success has not been received, then a secondary if. . .else statement is evaluated. If the current time of the Flash movie is greater than 25 seconds from the sendTime value, then it sends the playhead to the error label. Otherwise, the playhead will loop back to the previous frame with the wait label.
This action takes the server’s returned variable, timeDate, and use its value for the serverTime variable, which also updates the serverTime text field we created at this state.
You can modify this movie to work with as many text fields as you want. The server script supports either GET or POST methods. Remember, every data exchange with a Flash movie should use input, wait, output, and error states. Even if you are loading variables from a small .TXT file, you should confirm the download by checking for the presence (and value) of a terminal tag.
Flash Related Interview Questions
|Adv Java Interview Questions||J2EE Interview Questions|
|Adobe Flex 3 Interview Questions||Dreamweaver Interview Questions|
|3D Animation Interview Questions||Adobe Flash CS6 Interview Questions|
|Dreamweaver CS3 Interview Questions||Adobe Flex Interview Questions|
|Adobe Flex Actionscript Interview Questions||Gif Animation Interview Questions|
|Adobe Fireworks Interview Questions|
Understanding The Flash Framework
Exploring The Interface: Panels, Settings, And More
Using Tools For Navigation And Viewing
Working With Selections And The Pen Tool
Working With The Drawing And Painting Tools
Working With Text
Exploring The Timeline
Checking Out The Library: Symbols And Instances
Drawing In Flash
Animating In Flash
Using Bitmaps And Other Media With Flash
Designing Interfaces And Interface Elements
Understanding Sound For Flash
Importing And Editing Sounds In Flash
Optimizing Flash Sound For Export
Understanding Actions And Event Handlers
Navigating Flash Timelines
Controlling Movie Clips
Sharing And Loading Assets
Planning Code Structures
Creating Subroutines And Manipulating Data
Understanding Movie Clips As Complex Objects
Sending Data In And Out Of Flash
Understanding Html And Text Field Functions In Flash
What Is Generator?
Revving Up Generator
Working With Third-party, Server-side Applications
Working With Raster Graphics
Working With Vector Graphics
Working With Audio Applications
Working With 3d Graphics
Working With Quicktime
Working With Realplayer
Creating Full-motion Video With Flash
Creating Cartoon Animation With Flash
Planning Flash Production With Flowcharting Software
Working With Authoring Applications
Publishing Flash Movies
Integrating Flash Content With Html
Using Players, Projectors, And Screensaver Utilities
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.