Develop PHP Website for Learning Web Design Free Online
  Home   |   Forums   |   DevCMS
  Join   |   Log In
 
   

Flash and ActionScript 3 Tutorials - Learn Flash and ActionScript 3

Tutor at Develop PHP
Form Components Tutorial - PHP File and Flash Source
By: Adam      Created: Feb 11, 2009      Views: 27233 Tweet This Page  Post page to Facebook  Post page to Facebook

Download Source Files


In this free Flash CS3 + CS4 ActionScript 3.0 tutorial and source file download package you can learn how to create clean professional forms using the pre-baked flash components from the components library. I take you all the way through the file production in the video tutorial for greater understanding of how and why I do things in the code. Allow your website users to submit all types of input in all types of ways.




ActionScript 3.0 Code Reference Actionscript 3.0 Tutorial - Learn Actionscript 3.0

/*ActionScript 3.0 Script created by Adam Khoury @ www.developphp.com*/
// Imports needed for radio button grouping
import fl.controls.RadioButton;
import fl.controls.RadioButtonGroup;

// hide processing CM
processing_mc.visible = false;

// custom function we create to populate the comboBox list
function addCountriesToList ():void {
countryList.addItem( { label: "United States" } );
countryList.addItem( { label: "Mexico" } );
countryList.addItem( { label: "Canada" } );
countryList.addItem( { label: "United Kingdom" } );
}

// Run function above now
addCountriesToList ();

// make radio button group distictions
var radioGroup1:RadioButtonGroup = new RadioButtonGroup("radioGroupGender");
radioMale.group = radioGroup1;
radioFemale.group = radioGroup1;

// build variable name for the URL Variables loader
var variables:URLVariables = new URLVariables;

// Build the varSend variable
var varSend:URLRequest = new URLRequest("form_parse.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);

// handler for the PHP script completion and return of status
function completeHandler(event:Event):void {

// remove processing clip
processing_mc.visible = false;
name_txt.text = "";
email_txt.text = "";
msg_txt.text = "";
kids.value = 0;
checkBox.selected = false;

// Load the response from php here
status_txt.text = event.target.data.return_msg;
}

// Add event listener for submit button click
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);

// function ValidateAndSend
function ValidateAndSend (event:MouseEvent):void {

// validate fields
if(!name_txt.length) {
status_txt.text = "Please enter your name";
} else if (!email_txt.length) {
status_txt.text = "Please enter your email";
} else if (!msg_txt.length) {
status_txt.text = "Please enter your message";
} else {

// All is good, send the data now to PHP
processing_mc.visible = true;

// ready the variables in our form for sending
variables.userName = name_txt.text;
variables.userEmail = email_txt.text;
variables.userMsg = msg_txt.text;
variables.userCountry = countryList.value;
variables.userKids = kids.value;
variables.userGender = radioGroup1.selection.value;
variables.userNewsletter = checkBox.selected;

// Send the data to PHP now
varLoader.load(varSend);

} // close else condition for error handling

} // close validate and send function




Comment on Form Components Tutorial - PHP File and Flash Source

Search Tags:
form   ·  components   ·  radio   ·  button   ·  checkbox   ·  numeric   ·  stepper   ·  text   ·  textarea   ·  download   ·  website   ·  free   ·  tutorial   ·  video   ·  flash   ·  as3   ·  learn   ·  how   ·  tutorial   ·  create   ·  make   ·  source   ·  edit   ·  free   ·  actionscript   ·  3.0   ·  cs3   ·  cs4   ·  custom   ·  online   ·  script   ·  code   ·  site   ·  build   ·  
 
 
Arbitrary Links and Archives
Home
Active Forums
Members
SIte News
Link To Us
Gear
2009 Forum Archive
Programming Courses
Learn HTML
Learn CSS
Learn PHP
Learn MySQL
Learn Javascript
Learn jQuery
Learn ActionScript 3.0
Learn Java
Learn XML
DevelopPHP Requires Flash Player
Get Adobe Flash player
___________________________________________

Terms of Use  •  Privacy  •  Admin Notes

©2010 developphp.com   |   Powered By FlashBuildingHolder