PDA

View Full Version : component mail form


lelales
01-12-2007, 12:09 AM
Hello, I'm publishing in AS 2.0 for Flash player 7 and I am having trouble sending component values to a PHP form. I've done it before and I'm using the same code as before, but before I was using MX. Though I have cut and pasted my components from MX into Flash 8.

Well, I have searched all over and I can't seem to grabb the selected data from the component. My form code looks like this:
submit_mc.onRelease = function() {

var custname:String = t1.text;
LV_out.billing = Fbilling.selectedData;
LV_out.apptype = Fapptype.selectedItem.data;
LV_out.loantype = Floantype.selectedItem.data;
LV_out.purpose = Fpurpose.selectedItem.data;

The instance name value for the components is Fbilling, Fapptype etc. The form works fine except for the components. And I have searched the forums and web.

thanks

CyanBlue
01-12-2007, 12:23 AM
Indeed, I think I remember you asking similar question some time ago... :D

I suggest you start by removing that FMX component and replace it with the F7/F8 component... and make sure you are using the new syntax to get the data from the component...

lelales
01-12-2007, 01:01 AM
I changed the components and read the help files regarding components. Yet, it still doesn't work.

I changed the form code fromLV_out.apptype = Fapptype.ComboBox.selectedItem.data;


toLV_out.apptype = Fapptype.selectedItem;


I can't seem to find the correct terms to grad the data (or selected item) from the combobox.

Could you enlighten me?

thanks

lelales
01-12-2007, 01:10 AM
LV_out.billing = Fbilling.selectedItem.label;
LV_out.apptype = Fapptype.ComboBox.selectedItem.label;


LV_out.loantype = Floantype.selectedItem.label;
LV_out.purpose = Fpurpose.selectedItem.label;

as I saw this on another post. But to tell the truth, I'm operating blindly here.

thanks

CyanBlue
01-12-2007, 01:24 AM
Can you strip out the form and post it here???
Does your PHP script work properly???

lelales
01-12-2007, 01:25 AM
Yes, I can strip it out. Do you need the PHP also?

I'm working on it now.

thanks

lelales
01-12-2007, 01:31 AM
http://www.metapps.com/testing/order/asorg_componentform.zip
Look at the code on the "form code" layer
thanks Cyan Blue

CyanBlue
01-12-2007, 01:44 AM
Um... I don't understand...

You have a layer, form, in the main timeline...
Create another layer on top of it and put this line and test movie...
trace("Hello");
Do you see that output in the output panel??? I don't... It seems as if none of your script is working...

lelales
01-12-2007, 02:36 AM
And I'm very tired. Will have to look at it tomorrow.:o

thanks

CyanBlue
01-12-2007, 02:43 AM
Gotta go do some dishes... :D

lelales
01-12-2007, 05:10 PM
Hi, I tried the trace("Hello"); in the original file and the file I sent and they both work. Are you using Flash 8? I'm using Flash 8. The only thing I need to know, which I've spent hours trying to figure out, is how to grab the info from the components and send them to the PHP processing script. My code works for all form fields except the components.

This is basically what my code looks like:stop();
var LV_out:LoadVars = new LoadVars();
var LV_in:LoadVars = new LoadVars();
LV_in.onLoad = function(success) {
if (success) {
gotoAndPlay("Display");
} else {
trace ("Error loading data into flash");
gotoAndPlay("Error");
}
}
//----------
submit_mc.onRelease = function() {

var custname:String = t1.text;
LV_out.billing = Fbilling.selectedItem.label;
LV_out.apptype = Fapptype.ComboBox.selectedItem.label;


LV_out.loantype = Floantype.selectedItem.label;
LV_out.purpose = Fpurpose.selectedItem.label;

etc . . .

LV_out.sendAndLoad("register4.php", LV_in, "POST");
gotoAndStop("Loading");
mySO.data.voted = "yes";
mySO.flush();
};

thanks

CyanBlue
01-12-2007, 06:50 PM
One thing I have noticed last night was that there were components on the stage, but they did not have instance names... Maybe you need to check on that???

lelales
01-12-2007, 06:54 PM
Yes, both the original, and the form I sent have instance names on the component. Somthing like this should be simple, shouldn't it? I just can't find info on it.:p

thanks

CyanBlue
01-12-2007, 06:55 PM
I'll have to check on that when I get home... I don't have F8 here... :(

lelales
01-12-2007, 06:58 PM
Thanks a bunch Cyan Blue

Flash Gordon
01-12-2007, 07:13 PM
attached as well

/*
* Combo Box aka drop down menu/box
*/
list_cb.addItem("select", null);
list_cb.addItem("green", "green");
list_cb.addItem("yellow", "yellow");
list_cb.addEventListener("close", onClose);

function onClose():Void
{
if (list_cb.getSelectedItem().data != null)
trace("you selected " + list_cb.getSelectedItem().data);
}


/*
* radio buttons
*/
color.addEventListener("click", onClick);
function onClick():Void
{
if (color.selection != undefined)
trace("you selected " + color.selection.data);
}

lelales
01-12-2007, 07:54 PM
I tried to make your code work like this
submit_mc.onRelease = function() {
LV_out.loantype = Floantype.getSelectedItem().data;
etc.


But it doesn't work.
Do I need to add a listener? This is really puzzling me.

I also triedFapptype.addEventListener("close", onClose);

function onClose():Void
{
if (Fapptype.getSelectedItem().data != null)
Fapptype_a= Fapptype.getSelectedItem().data;
trace(Fapptype_a);
}

submit_mc.onRelease = function() {
LV_out.apptype = Fapptype_a;
etc . . .

The trace works, but I can't grab the variable "Fapptype_a" for the submit_mc.onRelease function

How can I grab this variable?
thanks

Flash Gordon
01-12-2007, 07:55 PM
you better zip up your file. I'm sure CyanBlue will look at it later.

:)

lelales
01-12-2007, 08:14 PM
http://www.metapps.com/testing/order/orderform.zip

The form is inside and MC, so you have to double click it to open it up and see the code. The main code to look at is on the layers named "form code" and "Flash Gordon."

thanks again guys ;)

Flash Gordon
01-12-2007, 08:44 PM
look at the radio button.

unique instance names....

lelales
01-12-2007, 09:32 PM
Yes, I saw that in your example, I guess I should have made the change in mine, as it was necessary. Yet, I still can't grab the data:o

thanks though.

-Sean

lelales
01-13-2007, 07:10 PM
Can someone please help? I need to grab the data from a combo box and radio button. This project is due by Tues and I still have a bunch of work to do.:o

Please help!!!

thank-a-you very mucho

lelales
01-13-2007, 11:20 PM
Okay, I guess this problem will remain unresolved. It's a simple form that needs to be sent to a PHP script. The only thing I need to do is grab the data from the components. I didn't think this would be so difficult, but due to lack of response, (no offense Flash Gordon and Cyan Blue) I assume it is a bigger problem than I could have imagined. I guess I will have to substitute an popup html and PHP form from the Flash web site.

And Cyan Blue, did you look into this last night? I haven't heard from you. I wish Macromedia or Adobe would publish info on this.

Thanks anyway, at least we tried. And when I figure out the solution, I will gladly post it.

-Sean

CyanBlue
01-15-2007, 01:29 PM
Well... I was just too lazy to even power up the computer over the weekend cuz I was sorta sick... :( I'll check on that when I get home tonight...

lelales
01-15-2007, 04:42 PM
Sorry to be such a bother. Hope you're feeling better today.:confused:

CyanBlue
01-17-2007, 02:33 PM
Totally forgot about this thread... Did you ever fix this??? I'll make sure look at the file tonight when I go home if you have not... Sorry about that...

lelales
01-17-2007, 02:56 PM
I haven't figured it out yet. I actually gave up on it till I finish the rest of the project. Yet, I would appreciate if you could look into it.

thanks

-Sean

CyanBlue
01-17-2007, 02:57 PM
Yeah... Will do... If I don't reply by tomorrow morning, post back to this thread... That means I am getting older and I forgot again... :(

CyanBlue
01-18-2007, 02:56 AM
How does this version work???

lelales
01-19-2007, 04:39 PM
It totally works. Thanks so much:)

CyanBlue
01-19-2007, 05:02 PM
Good to hear... ;)