PDA

View Full Version : CGI /loadVariables in Flash 5


McGousal
05-02-2001, 11:13 PM
I know HTML and some Flash, but no server-side CGI stuff, so bear with me.. I need to use loadVariables to POST and process CGI (CGI exists). I began by creating two input text fields (variables are named: "uname" amd "pass").

The existing html code (which works, naturally) is:

<FORM METHOD=POST ACTION="/cgi-mysite/login.pl">

Member Login <INPUT TYPE="text" SIZE="11" Name=Uname>
Username <INPUT TYPE="password" SIZE="11" Name=Pass >
Password <INPUT TYPE="IMAGE" SRC="login.gif" NAME=LOGIN>

----------------------------------------

I have a button instance to which I assign an action:

on (release) {
loadVariables ("http://www.mysite.com/cgi-mysite/login.pl", "", "POST");
}

What goes here to send the uname and pass variables ?
How do I make the Actionscript behave like the HTML code ?
What else do I need to check or fill in in the loadVariables dialogue box ?

Thanks in advance !

Jesse
05-03-2001, 12:23 PM
You need two variables in your Flash file to be filled out by the user:

Uname
Pass

They should both be strings.

Then the actions you have on your button should work fine. If they aren't, change the method to GET and see if it works then. The GET method is better for debugging because you will be able to see if the info is being passed properly to the script...

You may also be better off using GetURL at first (again for debugging purposes)

Cheers

Jesse

McGousal
05-04-2001, 05:37 AM
Assuming the movie has 100 variables besides Uname and Pass, will Flash will send the right ones without me specifying them, as you've indicated?

Is is possible that you're leaving something out... ?

Jesse
05-04-2001, 12:27 PM
What do you mean 100 variables beside each? Are you talking about radio-boxes or the like? You need to specify as much if you are, a look at the actualy HTML form would make things easier.

I assumed you had two fields, a Username field and a Password field, and a backend script which validated the variables passed to it, this is the most common scenario.

Cheers

Jesse

McGousal
05-04-2001, 07:36 PM
Any serious Flash application is likely to have more than two variables. How will Flash know which variables, (of many possible ones) to send with this command, which you say is just fine:

on (release) {
loadVariables ("http://www.mysite.com/cgi-mysite/login.pl", "", "POST");
}

I don't see how the variables were specified. Here's the original HTML code... it's essentially the same as in my original post:

<FORM METHOD=POST ACTION="/cgi-mysite/login.pl">
<TABLE> <TR><TD><b>Member Login</b><br><br>
<INPUT TYPE="text" NAME=Uname SIZE="11" ALIGN=CENTER MAXLENGTH="8">
<DIV ALIGN=CENTER>Username</DIV>
<INPUT TYPE="password" NAME=Pass SIZE="11" MAXLENGTH="8">
<DIV ALIGN=CENTER>Password</DIV>
<INPUT TYPE="IMAGE" SRC="login.gif" WIDTH=50 NAME=LOGIN>
</TD></TR></TABLE>

Of course "mysite.com" is not the real site with the CGI script. I've been on this for weeks and am getting nowhere.

Please help if you can.

Jesse
05-05-2001, 08:32 AM
POST and GET send all root level variables but the script will only process the variables it needs, extra variables aren't an issue.

Cheers

Jesse

McGousal
05-05-2001, 11:54 AM
on (release) {
getURL ("http://www.mysite.com/cgi-mysite/login.pl", "_blank", "GET");
}


works ... but I, because I used GET and not POST, the Browser URL address line show this:

http://www.mysite.com/cgi-mysite/login.pl?Uname=coolguy&Pass=cooltoys

-which is not good. And changing the GET to POST did not work:

on (release) {
getURL ("http://www.mysite.com/cgi-mysite/login.pl", "_blank", "POST");


So I tried the loadVariables option:

on (release) {
loadVariables ("http://www.chessaid.com/cgi-chessaid/login.pl", " ", "POST");
}


-and this doesn't work. What about the switches in the dialog box ?

URL: http://www.mysite.com/cgi-mysite/login.pl (of course!)

Location: target or level ? xxxxx what goes here ? a "0" .. a "1" ?, a "2" ?

Variables: send using POST (of course!)

Jesse
05-06-2001, 08:06 AM
Well you see, if GET Works you could use loadVariables with GET and it wouldn't be an issue because your user will remain within the Flash movie and therefore not be able to see the URL string. I always suggest GET to begin with for debugging. If you use GetURL and POST without the window _blank, does it work?

I would recommend your final code be this:

on (release) {
loadVariablesNum ("http://www.chessaid.com/cgi-chessaid/login.pl", 0, "POST");
}


or if that doesn't work:

on (release) {
loadVariablesNum ("http://www.chessaid.com/cgi-chessaid/login.pl", 0, "GET");
}

Cheers

Jesse

hinkle
05-10-2001, 11:19 PM
But my application can't use the GET method, cause the host of the script doesn't want really long URLs in the log, and doesn't GET have a limit on how much data you can send? For debugging GET works fine, but this application needs to be able to send pages of data at a time.

Why doesn't POST work?