05-16-2007, 05:07 PM
|
#1
|
|
Senior Member
Join Date: Dec 2006
Posts: 203
|
creating checkboxes in a flash form?
is this possible to creat checkboxes like u do in html, but in flash?
can someone explain how?
|
|
|
05-16-2007, 06:24 PM
|
#2
|
|
Super Moderator
Join Date: Jan 2006
Location: Los Angeles, CA
Posts: 1,080
|
make a small white box with a black outline. Turn it into a movieClip and then go into it. Add a second frame that has the white box with the black outline but on the second frame place an X inside the box. Then navigate to the root of the FLA and give the box an instance name of checkbox0. Then in the AS frame put this:
Code:
var myCheckBoxVar:String = "no selection";
checkbox0.onRelease = function():Void{
\\ make the checkbox0 MC go to the X frame
this.gotoAndStop(2);
\\ set some variable to indicate that this checkbox was clicked
myCheckBoxVar = "checkbox0";
}
That is how I would do it. Dvl
|
|
|
05-16-2007, 07:58 PM
|
#3
|
|
Senior Member
Join Date: Dec 2006
Posts: 203
|
creating checkboxes for a form
how do you go about doing this in flash? so that the checkboxes submit information to the e-mail, along w/ the rest of the data that is transferred?
is there a way to create this in flash? the checkboxes
|
|
|
05-16-2007, 08:43 PM
|
#4
|
|
Registered User
Join Date: May 2007
Posts: 4
|
Yes, it is built-in to Flash. Open the Components panel from the Window menu. Expand the UI Components section. Scroll down until you see Checkbox. Drag the Checkbox component onto the stage. You can drag a hundred of them if you want. Then you'll need to set up each checkbox's properties.
Select a checkbox on the stage. Then open the Property panel (if it's not already open at the bottom) and where it says <instance name>, give this checkbox a name. Something like cbAnswerA. Do this for each, so you might end up with cbAnswerA, cbAnswerB, cbAnswerC, and cbAnswerD.
Then for each of them, click on the Parameters tab in the Property panel. The label is the text next to the checkbox, so in my example, cbAnswerA would have a label A, cbAnswerB would have a label B, and so on. Label placement is whether or not you want the label to the left or right of the checkbox and selected means whether or not you already want a checkbox to be selected before anyone chooses anything.
|
|
|
05-25-2007, 11:30 PM
|
#5
|
|
Senior Member
Join Date: Dec 2006
Posts: 203
|
thanks guys, got that down now
but now .. im using php on my contact form.. do u guys know the php to retrieve the selection they made on the checkbox?
|
|
|
05-28-2007, 04:00 AM
|
#6
|
|
Senior Member
Join Date: May 2007
Location: Toronto,Canada
Posts: 530
|
CheckBox
put all your chechBoxs in move named: menuMc
call function in Submit button
function sendSubmit(){
var myVars:String;
for(i in menuMc){
if(menuMc[i].selected) myVars+= i+"="+menuMc[i].label+"&";
}
var sendVars:LoadVars= new LoadVars();
sendVars.load("http://www.yourwebsite.com/checkSelected.php?"+myVars);
}
Last edited by LOLFlash; 05-30-2007 at 03:46 AM.
|
|
|
06-06-2007, 01:33 AM
|
#7
|
|
Senior Member
Join Date: Dec 2006
Posts: 203
|
so that retrieves the information and sends it w/ the contact form?
|
|
|
06-07-2007, 03:07 AM
|
#8
|
|
Senior Member
Join Date: May 2007
Location: Toronto,Canada
Posts: 530
|
lol
kade
take a look in forum <-> search for "php loadvars" you can find hundreds ready to go examples haw to send and retrieve data to-from php
on your computer in examples folder you have macromedia example of login form
I gave just one way in case you dont know haw many check boxes on screen If you work with XML feed and boxes created on a fly and server need to save data of user choise
There is not much description you'r giving what you want
Please attach file of your application
Last edited by LOLFlash; 06-07-2007 at 03:10 AM.
|
|
|
06-07-2007, 06:00 AM
|
#9
|
|
Senior Member
Join Date: Dec 2006
Posts: 203
|
PHP Code:
ahhh ... hate when things dont work, so heres what i got, sorry i didnt specify, i got the checkbox created and working to get the response sent to my e-mail... but the whole form doesn't seem to be responding.. so what ya got on this ?
thanks
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$msg = "$name\n\n";
$msg .= "$message\n\n";
$signs_check = $_POST['signs_check']
$phone_check = $_POST['phone_check']
$mail_check = $_POST['mail_check']
$canvasing_check = $_POST['canvasing_check']
$donation_check = $_POST['donation_check']
$yardsign_check = $_POST['yardsign_check']
$host_check = $_POST['host_check']
$name = $_POST['name'];
$company = $_POST['company'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$comment = $_POST['comment'];
$to= '[email protected]';
$subject = "Website Contact";
$msg .= "Name: $name\n\n";
$msg .= "Company: $company\n\n";
$msg .= "Phone: $phone\n\n";
$msg .= "Email: $email\n\n"
[CODE][/CODE]
$msg .= "Comment: $comment\n\n";
$headers .= "From: $name <$email>";
mail($to, $subject, $msg);
?>
Code:
on (release) {
var nLv:LoadVars = new LoadVars();
nLv.name = name.text;
nLv.company = phone.text;
nLv.phone = email.text;
nLv.email = hear.text;
nLv.comment = comments.text;
nLv.signs_check = signs_check.selected;
nLv.phone_check = phone_check.selected;
nLv.mail_check = mail_check.selected;
nLv.canvasing_check = canvasing_check.selected;
nLv.donation_check = donation_check.selected;
nLv.yardsign_check = yardsign_check.selected;
nLv.host_check = host_check.selected;
nLv.sendAndLoad("form.php",nLv,"POST");
gotoAndPlay (2);
}
|
|
|
06-07-2007, 02:04 PM
|
#10
|
|
Senior Member
Join Date: May 2007
Location: Toronto,Canada
Posts: 530
|
send_loadVars
Quote:
Originally Posted by Paul Ferrie
LoadVariablesNum is outdated.
You have a lot more control over the variables your sending and receiving with the php script using sendAndLoad()
Using LoadVariablesNum means
"loadVariablesNum("verzenden.php", 0, "POST");"
Any variables on level 0 will be sent to the php script regardless of wether you need them to be sent or not.
With sendAndLoad you can specifcally declare what variables should be sent.
Here a typical contact form script i use.
ActionScript Code:
butSubmit.onRelease = function() {
//You could do some checking of the forms here to make sure the relevent fields
//are filled
submitContact();
};
function submitContact() {
//define object to hold result
result_lv = new LoadVars();
//Define object to hold vars
cc_lv = new LoadVars();
//Attach vars to object
cc_lv.me_name = txName.text;
cc_lv.me_subject = txSubject.text;
cc_lv.to_email = mcToEmail.txEmail.text;
cc_lv.me_email = txUemail.text;
cc_lv.me_msg = txMessage.text;
//Send vars to script
cc_lv.sendAndLoad(path2php + "contact.php", result_lv, "POST");
result_lv.onLoad = function(success) {
if (success) {
//on the last line of the php script put
// echo "&retval=1&";
if (result_lv.retval.length > 0) {
gotoAndStop(8);
} else {
//incase of error trace what has been sent back
trace("ERROR:" + newline + unescape(result_lv));
}
}
};
}
This for of using sendAndLoad() i use to handle all my flash php request's
Hope it helps
|
continue..
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 05:45 AM.
///
|
|