Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : Variable Trouble!


CF_Admin
5/5/2004 10:59:59 PM
I want to pass a user name variable from a Flash registration form
(register.swf) to a Flash login form (login.swf), but instead of passing the
variable, it passes the variable name. What am I doing wrong? Please someone
help. This seems pretty basic... am I missing some simple syntax, or ordering
the script wrong for the timing in grabbing value?

Also, does anyone know a way to pass variables directly between Flash movies
without using HTTP?

Here is the code in question (everything else before this works so I leave it
off):

else {
usern = (uname);
register.putUser(fname,lname,uname,passw,email,bio);

}
}
function putUser_Result(result)
{ trace (result)
if (result == 1) {
error_message.text = "That user name is taken, please try again";
}
else if (result == 9) {
getURL("login.swf?user=usern", this);

_______________________________________________________________________________

I have also tried:

else {
set (usern, uname);
register.putUser(fname,lname,uname,passw,email,bio);

}

}
function putUser_Result(result)
{ trace (result)
if (result == 1) {
error_message.text = "That user name is taken, please try again";
}
else if (result == 9) {
getURL("login.swf?user=usern", this);


_______________________________________________________________________________

And:

else {

register.putUser(fname,lname,uname,passw,email,bio);

}

}
function putUser_Result(result)
{ trace (result)
if (result == 1) {
error_message.text = "That user name is taken, please try again";
}
else if (result == 9) {
getURL("login.swf?user=uname", this);


________________________________________________________________________________
__-

As well as many others... it seems to me the last one posted (the first one I
tried) should work.

"register.putUser(fname,lname,uname,passw,email,bio);" inserts uname and all
other variables into the database fine, so the variable uname holds the value I
want. However When I try to pass it to login.swf and populate the field it
displays "uname" or "usern" or whatever variable name is used, instead of the
value I want passed.

I have also tried:

getURL("login.swf?user=form.uname", this); (displays form.uname in login.swf)

getURL("login.swf?user=User_Name.uname", this); (where User_Name is the
textfield instance name. Similar result to above)

getURL("login.swf?user='uname'", this); (gives me 'uname' including the single
quotes in login.swf.)

... here's the relevant line in login.swf:

user_name_l.text = user;

Maybe there's something else I need to do on the recieving end to properly
grab the value?

Lastly, I did get it to work by remoting to CF, doing a lookup with a reverse
order by time, with only 1 row returned. Problem, on one instance CF inserted a
new record and recoreded the time as 15 seconds before the previous insert
(?!)... I don't know why, and it only happened once, but it obviously retrieved
the previous user name instead of the newly registered user name. This solution
also seems rather tedious and less clean, and leaves open possibilities for
problems like the one I mention.

HELP!!!

Thanks in advance!

P.S. Sorry for the double post, but I really need an answer to this. I saw
other posts after mine getting answers, so I know people were online. I thought
a new title might help...

egorlebowski
5/5/2004 11:04:50 PM
I think what you're looking for is:

CF_Admin
5/5/2004 11:08:09 PM
That was it! Thank you!!! I knew it was something easy that I had missed...

AddThis Social Bookmark Button