Groups | Blog | Home
all groups > macromedia flash flash remoting > may 2004 >

macromedia flash flash remoting : Variable Trouble!


CF_Admin
5/5/2004 10:54:02 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, but try finding any information in Flash help,
or Macromedia's online support!

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

else {
[b]usern = (uname);[/b]
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 {
[b]set (usern, uname);[/b]
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.

"[b]register.putUser(fname,lname,uname,passw,email,bio);[/b]" 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:

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

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

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

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

[b]user_name_l.text = user;[/b]

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. is there a way that anyone knows about to pass variables directly between
Flash movies without using HTTP?

CF_Admin
5/5/2004 11:20:30 PM
This question was answered by egorlebowski, on Wednesday, May 5, 2004 4:08 PM
Answer:
I think what you're looking for is:

getURL("login.swf?user="+usern, this);

[b]I had to double post to get this simple answer... WHY CAN'T MM make these
simple things EASY to find in Help and or their online documentation and
support? Why doesn't MM have anyone answering these forums!? I have seen many
posts that weren't answered until months later, or ever answered, and I have
yet to see a single post answered by anyone from MM... seems like MM is
dropping the ball to me!!! [/b]
AddThis Social Bookmark Button