Problems with Forms in ActionScript 3.0

This is a discussion on "Problems with Forms in ActionScript 3.0" within the Flash & Multimedia Forum section. This forum, and the thread "Problems with Forms in ActionScript 3.0 are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 7th, 2007, 14:51
New Member
Join Date: Sep 2007
Location: usa
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Problems with Forms in ActionScript 3.0

I am trying to create a form in Flash CS3 and I have used ActionScript 3.0 to construct nearly all of it. Now, I need to take the data submitted on the form and send it to a PHP file for processing. Problem is, Adobe's help files on this are very vague (at least to me!).

I have found articles on how to do this using prior versions of ActionScript but, since I have everything else done in 3.0, I'd hate to have to revert back to an older version and start over.

HELP, PLEASE!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 7th, 2007, 16:33
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Problems with Forms in ActionScript 3.0

try posting your code.
we don't have a clue what you've done atm
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 7th, 2007, 17:08
New Member
Join Date: Sep 2007
Location: usa
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Problems with Forms in ActionScript 3.0

Yeah, I guess that would help

Here it is (minus extraneous what-not):

Code: Select all
function showClaimForm(event:Event):void
{
  var today = new Date();
  
  var labelFormat:TextFormat = new TextFormat();
  labelFormat.font = "Verdana";
  labelFormat.size = 10;
  labelFormat.color = 0x0069B3;
  labelFormat.align = "right";
  
  var dlrInfo:TextFormat = new TextFormat();
  dlrInfo.font = "Verdana";
  dlrInfo.size = 10;
  dlrInfo.color = 0x000000;
  
  var proofInfo:TextFormat = new TextFormat();
  proofInfo.font = "Verdana";
  proofInfo.size = 10;
  proofInfo.color = 0x000000;
  proofInfo.align = "right";
  
  var dealerLabel_tf:TextField = new TextField();
  dealerLabel_tf.htmlText = "<b>Dealer:</b>";
  dealerLabel_tf.antiAliasType = AntiAliasType.ADVANCED;
  dealerLabel_tf.x = 0;
  dealerLabel_tf.y = 10;
  dealerLabel_tf.width = 130;
  dealerLabel_tf.setTextFormat(labelFormat);
  form.addChild(dealerLabel_tf);
 
  var dealerInfo_tf:TextField = new TextField();
  dealerInfo_tf.htmlText = dlrAddress;
  dealerInfo_tf.x = 140;
  dealerInfo_tf.y = 10;
  dealerInfo_tf.width = 300;
  dealerInfo_tf.height = 50;
  dealerInfo_tf.setTextFormat(dlrInfo);
  form.addChild(dealerInfo_tf);
 
  var lmcInvLabel_tf:TextField = new TextField();
  lmcInvLabel_tf.htmlText = "<b>LMC Invoice #:</b>";
  lmcInvLabel_tf.antiAliasType = AntiAliasType.ADVANCED;
  lmcInvLabel_tf.x = 0;
  lmcInvLabel_tf.y = dealerLabel_tf.y + 55;
  lmcInvLabel_tf.width = 130;
  lmcInvLabel_tf.setTextFormat(labelFormat);
  form.addChild(lmcInvLabel_tf);
  var lmcInvNum_ti:TextInput = new TextInput();
  lmcInvNum_ti.width = 150;
  lmcInvNum_ti.move(140, 65);
  form.addChild(lmcInvNum_ti);
  
  var lmcInvDateLabel_tf:TextField = new TextField();
  lmcInvDateLabel_tf.htmlText = "<b>LMC Invoice Date:</b>";
  lmcInvDateLabel_tf.antiAliasType = AntiAliasType.ADVANCED;
  lmcInvDateLabel_tf.x = 0;
  lmcInvDateLabel_tf.y = lmcInvLabel_tf.y + 25;
  lmcInvDateLabel_tf.width = 130;
  lmcInvDateLabel_tf.setTextFormat(labelFormat);
  form.addChild(lmcInvDateLabel_tf);
  var lmcInvMonth_cb:ComboBox = new ComboBox();
  lmcInvMonth_cb.width = 40;
  lmcInvMonth_cb.rowCount = 10;
  
  for (m = 1; m < 13; m++) {
   lmcInvMonth_cb.addItem({label:m});
   if ((today.month + 1) == m) {
    lmcInvMonth_cb.selectedIndex = m-1;
   }
  }
  lmcInvMonth_cb.move(140, lmcInvNum_ti.y + 25);
  form.addChild(lmcInvMonth_cb);
  
  var lmcInvDay_cb:ComboBox = new ComboBox();
  lmcInvDay_cb.width = 40;
  lmcInvDay_cb.rowCount = 10;
  
  for (d = 1; d < 32; d++) {
   lmcInvDay_cb.addItem({label:d});
   if ((today.day + 1) == d) {
    lmcInvDay_cb.selectedIndex = d;
   }
  }
  lmcInvDay_cb.move(lmcInvMonth_cb.x + 43, lmcInvNum_ti.y + 25);
  form.addChild(lmcInvDay_cb);
  
  var lmcInvYear_cb:ComboBox = new ComboBox();
  lmcInvYear_cb.width = 70;
  
  var yrIndx:int = 0;
  for (yr = 2006; yr < 2008; yr++) {
   lmcInvYear_cb.addItem({label:yr});
   if (today.getFullYear() == yr) {
    lmcInvYear_cb.selectedIndex = yrIndx;
   }
   yrIndx++;
  }
  lmcInvYear_cb.move(lmcInvDay_cb.x + 43, lmcInvNum_ti.y + 25);
  form.addChild(lmcInvYear_cb);
  
  var reasonForRequestLabel_tf:TextField = new TextField();
  reasonForRequestLabel_tf.htmlText = "<b>Reason For Request:</b>";
  reasonForRequestLabel_tf.antiAliasType = AntiAliasType.ADVANCED;
  reasonForRequestLabel_tf.x = 0;
  reasonForRequestLabel_tf.y = yValue;
  reasonForRequestLabel_tf.width = 130;
  reasonForRequestLabel_tf.setTextFormat(labelFormat);
  form.addChild(reasonForRequestLabel_tf);
   
  var reasonForRequest_ta:TextArea = new TextArea();
  reasonForRequest_ta.width = 300;
  reasonForRequest_ta.height = 70;
  reasonForRequest_ta.move(140, yValue);
  form.addChild(reasonForRequest_ta);
  
  var submitRequest_btn:Button = new Button();
  submitRequest_btn.label = 'Submit Request';
  submitRequest_btn.emphasized = true;
  submitRequest_btn.move(140, yValue + 75);
  form.addChild(submitRequest_btn);
  
  
  submitRequest_btn.addEventListener(MouseEvent.CLICK,processTheClaim);
  function processTheClaim():void {
   var request:URLRequest = new URLRequest();
   request.url = "processClaim.php";
   request.method = URLRequestMethod.POST;
   request.data = form;
   var loader:URLLoader = new URLLoader();
   loader.dataFormat = URLLoaderDataFormat.VARIABLES;
   loader.addEventListener(Event.COMPLETE, completeHandler);
   try
   {
    loader.load(request);
   }
   catch (error:Error)
   {
    trace("Unable to load URL");
   }
   
   function completeHandler(event:Event):void
   {
    trace(event.target.data);
   }
  } 
    }
    else
    {
        trace("loader is not a URLLoader!");
    }
}

Last edited by karinne; Sep 7th, 2007 at 17:36. Reason: Please use [ code ]...[ /code ] tags when displaying code!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 7th, 2007, 20:37
Multimedia Specialist
Join Date: Apr 2007
Location: Arizona
Age: 25
Posts: 666
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Problems with Forms in ActionScript 3.0

This is the basics of what you are wanting to do...it's much more complicated in AS3 and AS2 so have a read through this and see if it makes any sense....are you familiar with asp or php?

http://www.flash-db.com/Tutorials/sa...ata.php?page=2

Cheers,

Scott
Last Blog Entry: Yay!? (Oct 8th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
actionscript, form data

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
And why do I have problems with FF and login forms? HitByLife Webforumz Cafe 3 Feb 1st, 2008 07:32
Radio Button Problems in ActionScript 3.0 dgstarr Flash & Multimedia Forum 1 Sep 6th, 2007 17:11
Actionscript within .NET timshih ASP.NET Forum 0 Aug 16th, 2007 00:56
actionscript cressy Flash & Multimedia Forum 3 Jul 24th, 2007 07:29
FLV Player Actionscript problems kalli21 Flash & Multimedia Forum 2 May 2nd, 2007 00:44


All times are GMT. The time now is 18:48.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved