Categories
Featured jobs
» More ActionScript, Flash and Flex jobs.
» Advertise a job for free
Our network
Advertisement

 »  Home  »  Tutorials  »  Flash  »  Beginner  »  Converting Basic HTML Forms to Flash

Converting Basic HTML Forms to Flash

By Jesse Stratford | Published 09/9/2005 | Beginner | Rating:
Jesse Stratford
Jesse lives and works in Melbourne Australia. He is the Cofounder and a Director of http://ActionScript.org. A Flash enthusiast, teacher, author, freelancer and speaker Jesse enjoys participating in the http://ActionScript.org community and the wider Flash scene when he has time. 

View all articles by Jesse Stratford
Page 1 of 2
Written by: Jesse Stratford
Time: 15 - 30 minutes.
Difficulty Level: Beginner
Requirements: Flash 5 or higher
Topics Covered: How to convert basic HTML forms to basic Flash forms.
Assumed knowledge: First four Beginner tutes as always. A bit of HTML knowledge. There is no example source for this tute. :o)

Converting HTML Forms To Flash

OK boys and girls, this one warrants a tutorial based on the number of requests we get on the forums and about the place. Most people aren't server-side scripters and yet they like to be able to use things like CGI and PHP for simple things like contact forms and the like. And often as not we get people posting these huge reams of HTML form code, accompanied by "How do I do this in Flash? Thanks!"

Converting HTML forms to Flash is pretty easy (for the most part). The thing to remember is that (in general) the server-side script which processes the data you send doesn't know or care where the data came from, it just knows what it has to do once it gets it. With that in mind, it is safe to say that we can simply replicate the HTML form in Flash and call the same script for processing, and everything should work out just fine.

Most HTML form elements can be replicated in Flash based on rules. Let's make up a basic HTML form. Something simple. OK here's a simple HTML form which takes one input via a text field, has one hidden field, and submits using POST to some backend script. (Don't try and run it, it doesn't work.)


What's your name?


The HTML source to this form is about as simple as it comes. See it here.

So here's where our 'rules' come in. First the input field. Flash's equivalent of this is... you'll never guess it... an Input field! The only trick is that you have to give the field the variable name the form processor expects. In this case, line 3 specifies that the input field stores the variable 'myName' so you create your Flash input field (on the main stage) with the variable 'myName' assigned to it. Next the hidden field. Again this is really easy. Line 5 shows we have a hidden field, marked by the variable 'secret', whose value in this case is the shamelessly self-promoting string, "ActionScripts.org rules!". This is even easier to replicate in Flash, since it's just a variable with a non-editable value. In the Actions panel on the main stage, enter:

secret = "ActionScripts.org rules!";

That's the fields done. Turn the page *bling*.


Spread The Word / Bookmark this content

Clesto Digg it! Reddit Furl del.icio.us Spurl Yahoo!

Related Articles
Comments



Search Entire Site
Add to Google
Advertisements
Article Options
Latest New Articles
Set up a simple IIS Server for Flash
by Peter McBride

Day 1 at FITC Toronto 2008
by Anthony Pace

Simple reflection effect with AS2
by Jean André Mas

ActionScript.org Meets Josh Tynjala (aka dr_zeus)
by ActionScript.org Staff

Rapidly Create Online Flash Movies to Help Users Market, Sell and Support Software and Hardware
by Sabrina F

mailing list
Enter your email address:
mailing list
Subscribe Unsubscribe
© 2000-2007 actionscript.org! All Rights Reserved.
Read our Privacy Statement and Terms of Use...
Our dedicated server is hosted and managed by WebScorpion Webhosting.