button and text input components
by lexamus » Wed, 11 Jun 2008 06:47:45 GMT
i have a part of my website where i want there to be a sort of form, so i have
used about 10 text input field components and placed a button component at the
bottom...now using actionscript how do i get these 2 components to work
together and how do i make sure that when someone clicks the button the
information in the text input fields will be emailed to a specified email
address?? help is sooo greatly appreciated!
Re: button and text input components
by jimbo123654 » Thu, 12 Jun 2008 21:46:02 GMT
hey,
Well you need to give all your text fields an instance name so you can refer
to them in AS then either you can select the button then press F9 and put the
script on the button object or make a new layer at the top of your main time
line and put the script there in the same frame as the button not the same
layer though,
The script would be something:
button_name.onRelease = function(){
first_var_name = frist_textfield_name.text;
//repeat this for all your text fields they are now captured and stored in the
variables
}
As for emailing this ifnormation you would need to create a couple of loadVars
objects one to to send the info and one to recieve a reply and then send the
info to a PHP page use the mail function of php to send info and send back a
message that can then be output in a dynamic text field so that your user can
knows that the info has been sent or not. It gets a bit in depth so look up
LoadVars in the user manuals in flash and see if you can work it htrough from
there or find some tutorials on using LoadVars.
but pretty much if had something like:
var send_lv:LoadVars = new LoadVars();
var recieve_lv:LoadVars = new LoadVars();
function SendData(){
recieve_lv.onLoad = function(success:Boolean){
if(success){
theMsg_txt.text = recieve_lv.msg;
}
else{
theMsg_txt.text = "Sorry! a problem occur info not sent";
}
}
send_lv.sendAndLoad("mailme.php",recieve_lv,POST);
}
myButton.onrelease = function(){
send_lv.firstName = firstName_txt.text;
send_lv.lastName = lastName_txt.text;
SendData();
}
This would send the data to mailme.php if the swf and the php pages where at
the same level in the same directory otherwise you would need to change that in
the sendAndLoad function so thta the data was directed to the right directory
to fiind the page on the server
Hope this helps you out
Similar Threads:
1.receiving text from text input component
hey all, I am trying to get a variable from a text input component box that is
located inside a movie clip object. I am testing it by reading the output
panel upon clicking a button set up in another movie clip instance. Here is
the code:
this.inputScreen.startAreaMC.startButton.onPress = function(){
trace(videoID);
trace("Ok");
}
no matter what I type in the input component box, the output I always get is:
undefined
OK
why do I keep getting undefined?
2.Remove input text on input text box select?
Right now I've got an input text box with an instance name of EMail and Var of
EMail. Then in my AS I've got:
var EMail:String = "Enter Your Email Address";
which puts "Enter Your Email Address" in the text box when it displays. What
I'd like to do is when a user clicks inside the box to enter their email
address is for that string to disappear.
3.Animated Text Input Component
I am having a nightmare
I have a text input component that animates on my screen, and no matter what i
try cant get it to actually display any text.
I have tried embedding the fonts.
Below is my code
var _myVerdana:myVerdana = new myVerdana();
//lets create a text format object for the input boxes
var format:TextFormat = new TextFormat();
nameTextInput.textField.defaultTextFormat = format;
nameTextInput.textField.embedFonts = true;
nameTextInput.textField.antiAliasType = AntiAliasType.ADVANCED;
nameTextInput.textField.autoSize =
TextFieldAutoSize.LEFT;
nameTextInput.text = "test";
format.font = _myVerdana.fontName;
format.color = 0xFFCCCC;
any help would be greatly appreicated
4.halo effect for text input component
how does macromedia achieve the halo effect on the text input "search" component seen at the top right of this page. i see that "radiobutton", "button" and some other components allow you to customize them with the following...
submit.setStyle("fontFamily", "verdana");
submit.setStyle("fontSize", "11");
submit.setStyle("fontWeight", "bold");
submit.setStyle("color", "0x5B5642");
submit.setStyle("themeColor", "haloOrange");
any help is much appreshiated (sp), thanks - Matthew
5.input text component error
I have created a series of forms for an ecommerce app. I have a movie clip
called "billInfo" being placed dynamically- there is a combobox with a
dataprovider for the states. It functions fine.
when a person hit's a "next button" I store the collected info, remove the
form and load the next screen.
The second screen contains another combo box. This combo box won't display
"selected" data. the dropdown list works and displays information and I can
select items but the label displayed remains blank! I tried an experiment by
placing a inputtext component on the same screen and this is also won't display
anything. it won't even let me give it focus ( click inside it). If I remove
the combo box from the first form, the second form combobox works fine. It's
almost like I can't use two instances of that component without the second
instance refusing to work.
Is this a bug in the component?
I'm running flash mx 2004 professional on a mac. Any help would be great I'm
so close to completing this purely flash client ecommerce site but this is
sticking me bad.
Jared
6. naming var component input texts
7. Changing the value of a text input component
8. input text component