converting HTML Form to ActionScript

  • uniqueminer
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 26, 2007
  • Posts: 14
  • Loc: Pasadena, California
  • Status: Offline

Post May 8th, 2007, 8:48 pm

I just converted my site to Flash but need help converting my list builder html form to ActionScript. Here it is:
_________________________________________________________________________
<FORM ACTION="http://lb.bcentral.com/ex/manage/subscriberprefs.aspx" METHOD="POST">
<div align="center"><FONT color="#663300" SIZE="-1" FACE="arial, helvetica">
<STRONG>Register for Bonnie Sherman and Associates email updates</STRONG> </FONT> <BR>
<INPUT TYPE="TEXT" NAME="email" />
<INPUT TYPE="HIDDEN" NAME="customerid" value="26024" />
<INPUT name="SUBMIT" TYPE="SUBMIT" style="background-color:white;color:brown;font-weight:bold" value="Sign up" />
</div>
</FORM>
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 8th, 2007, 8:48 pm

  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Joined: Jan 12, 2005
  • Posts: 778
  • Loc: In the heart of California, Fresno.
  • Status: Offline

Post May 8th, 2007, 10:12 pm

Hmmmm, let's see...

The form action will be your submit button action:
Code: [ Select ]
on (release) {
getURL ('http://lb.central.com/ex/manage/subscriberprefs.aspx',POST);
}
  1. on (release) {
  2. getURL ('http://lb.central.com/ex/manage/subscriberprefs.aspx',POST);
  3. }


Make two input text fields with variable (var) names: email and customerid

For the hidden text field action you need to write it as so:
Code: [ Select ]
customerid = "26024"


There you go, that should do it. Your welcome. :)
http://www.JamesBelk.com Stay Tuned for the new era in Belk Media Design
  • uniqueminer
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 26, 2007
  • Posts: 14
  • Loc: Pasadena, California
  • Status: Offline

Post May 10th, 2007, 5:57 am

It worked! Well, part of it anyway. The submit button action code got me passed the error I was getting. It actually goes to the right server now. My problem now is that the variables. Could you give me more details on how to include these fields? If not, offer a link to a detailed tutorial that focus on how to make a hidden text field that can have actions applied to it? Thank you.
  • Belk Media Group
  • Graphic Monk
  • Professor
  • User avatar
  • Joined: Jan 12, 2005
  • Posts: 778
  • Loc: In the heart of California, Fresno.
  • Status: Offline

Post May 10th, 2007, 12:47 pm

k, the hidden text field just dont put it on the stage. Create a dynamic text field and drag it off to the left of the stage, or whereever. In the properties where it says "var" give it the corresponding variable name.
For the email, create an input text field field and for "var" also give it the corresponding variable name.

Both text fields can be created with the text tool. In the upper left corner of the properties is a drop down menu for text type; static, dynamic, & input.
http://www.JamesBelk.com Stay Tuned for the new era in Belk Media Design
  • uniqueminer
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 26, 2007
  • Posts: 14
  • Loc: Pasadena, California
  • Status: Offline

Post May 11th, 2007, 12:00 pm

I appreciate you sticking with me on this. Here are my questions:
1- Where do I type the [customerid = "26024"] code. I ask because the action script area is not allowing me to write it there.
2- Is the hidden code a dynamic or input text field?
  • zhaojany
  • Student
  • Student
  • User avatar
  • Joined: Aug 03, 2006
  • Posts: 78
  • Status: Offline

Post May 11th, 2007, 4:25 pm

1 you can put the code on the frame where your textfield located,also you can put the text field in a mc ,you put the code on the mc.

2 if you want to load the value of the textField into the textField dynamicly you choose dynamic,if you want the user to input then choose input

my english is poor so don't know
is this the point you want :)
  • uniqueminer
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 26, 2007
  • Posts: 14
  • Loc: Pasadena, California
  • Status: Offline

Post May 16th, 2007, 8:35 am

Okay, I am almost there. I have solved the problem with the hidden text field by adding "?c=26024" onto the submit button action that OriginNO_II gave me.

on (release) {
getURL ('http://lb.central.com/ex/manage/subscriberprefs.aspx?c=26024',POST);
}

It works up to that point, and I need help to finish the action. The email list builder that I am trying to call up with the input text is not recognizing the email. I think that the email text that is imputed is not following the getURL command and therefore not able to recognize it, or that it is not named correctly.
  • uniqueminer
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 26, 2007
  • Posts: 14
  • Loc: Pasadena, California
  • Status: Offline

Post May 16th, 2007, 8:36 am

FYI: I am using Flash 8.
  • uniqueminer
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 26, 2007
  • Posts: 14
  • Loc: Pasadena, California
  • Status: Offline

Post May 16th, 2007, 3:31 pm

Does anyone have an URL to another site that is similar to this one? Maybe it would be good to throw this problem around to others. I found this script converter on
http://t8design.com/weblogs/?p=6
this is what it came up with when I took the browser (in Firefox) to my HTML form page, but of course it has errors and doesn't run correctly:

// create a new listener object;
submitObj = new Object();

// handle button click events;
submitObj.click = function() {
this.submitForm();
}

// handle enter key events;
submitObj.enter = function() {
this.submitForm();
}

// method to submit our form;
submitObj.submitForm = function() {
// post variables;
var post_lv:LoadVars = new LoadVars();
post_lv["email"] = "";
post_lv["customerid"] = "26024";
post_lv["SUBMIT"] = "Sign up";

// The document location is file:///C:/Documents%20and%20Settings/HP_Owner/Desktop/bonnie%20sherman/POST%20function.html
// The form action is /http://lb.bcentral.com/ex/manage/subscriberprefs.aspx
url = "file://localhost/http://lb.bcentral.com/ex/manage/subscriberprefs.aspx";

// Submit the form in a new window. Test that the form method is correct
post_lv.send(url,"_blank","POST");
}

// Reference to instance name of form submission button.
submit_btn.addEventListener("click", submitObj);

// Reference to last field in form that users presses enter in.
password_txt.addEventListener("enter",submitObj);
  • uniqueminer
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 26, 2007
  • Posts: 14
  • Loc: Pasadena, California
  • Status: Offline

Post June 25th, 2007, 6:43 pm

Can ActionScript communicate with a jsp file?

I just recently changed my list builder because Microsoft's bCentral list builder went under. My new list builder gave me this HTML form to communicate with their jsp file:

<FORM ACTION="http://visitor.constantcontact.com/d.jsp" target="_blank" METHOD="POST">
<div align="center"><FONT color="#663300" SIZE="3" FACE=" MBell Bold Leftie">
<strong>Register for Bonnie Sherman and Associates email updates</strong></FONT><BR>
<INPUT TYPE="TEXT" NAME="ea" />
<INPUT TYPE="HIDDEN" NAME="m" value="1101703870615" />
<input type="hidden" name="p" value="oi" />
<INPUT name="SUBMIT" TYPE="SUBMIT" style="background-color:E0D4BB;color:663300;font-weight:bold" value="Sign up" />
</div>
</FORM>

I tride to use the format that jsonchiu gave me but it does not work. Here is what I did:

//create a new LoadVars object
var _lv:LoadVars = new LoadVars();

//when you click the submit button
submit_btn.onRelease = function()
{
//any input variables are added as properties of the LoadVars object
_lv.ea = email_txt.text;
_lv.m = 1101703870615;
_lv.p = oi;

//send info!
_lv.send("http://visitor.constantcontact.com/d.jsp", "GET");
}

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 43 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.