all groups > macromedia flash flash remoting > june 2004 >
Hello - (this is reposted - apologies in advance but not sure if it was submitted) I am running a dev server with CFMX Server 6.1, Flash MX 2004 and Flash Remoting components. I was testing Flash remoting by creating a simple username/password authentication app. -The form is in flash, with fields called username and password. -I send them packaged as properties in an object var params=new Object(); params.username=_root.username.text; params.password =_root.password.text; The Flash Comm App Debugger tracks it as it is being passed to the ColdFusion Page MethodName: "xxx.yyy.dev.remoting_study.test_07.login" Parameters (object #2) .....[0] (object #3) .........."[object Object]" .....[1] (object #4) ..........password: "1234" ..........username: "abcd" However, once the data is received in the CF page, I cannot seem to "get the data" using FLASH.params. I tried FLASH.params[1].username and FLASH.params[1].password for example, but I get an "USERNAME is undefined" or "PASSWORD is undefined" when I try to retrieve them, I have tried passing the data from Flash in various other fashions myService.login(returnObj,params) // orignial myservice.login(returnObj,param.username,param.password); // another way myService.login(returnObj,{username:xxxx, password:123 }); // another way and also tried alternatives to receiving the data in the ColdFusion page/service (a FOR loop to read the array, reading it like a struct() object)...but I keep on getting the data passed as undefined... However, I can set values in the FLASH.params scope in the web page and pass it from the CF page back to flash, ex. <cfscript> fReturn=StructNew(); fReturn.status=success; FLASH.result=fReturn; // etc </cfscript> Anyone encounter this before??? Long and Short...I can pass the data from Flash to CF, but the CF does not receive it; I can create and process data from a CF page and pass it back to Flash. Am I missing something with respect to the syntax that retrieves the data? All connections, gateways etc. are fine otherwise. Look forward to your responses.... Edward
try capitalizing the returned variables from CF. also, for testing purposes return the entire struct outside of the cfscript tag. try this as a test. pass your username and password variables as you listed. then in your CF function, do this: <cfscript> fReturn=StructNew(); fReturn.un = FLASH.params[1].username; fReturn.pw = FLASH.params[1].password; </cfscript> <cfreturn fReturn> and remember, CF returns variables in CAPS. therefore, to access the returned variables in your flash return handler you would grab it with the following: testUserResult = result.UN; testPasswordResult = result.PW; if you trace the above flash variables it should spit out the original username and password variables from your flash app. let me know if this is still trouble or if you have questions. HI_C
Hi "HI_C" Sorry for the delayed response, I actually tried to respond earlier but the web-based version of the forums seem to be down, so I had to fire up my old news reader to this message. The first thing I have to say is a a Homer Simpson DOH! for not checking for caps. There was two things I did to get the info from Flash to CF - 1. The vars sent from Flash to CF were lower cased in Flash, but I capitalized them in CF and that seemed to work. 2. I sent the info from flash stored within an OBJECT. So, I expected to receive it as a "struct" (?) within CF - however, this is how I passed it.... loginBtn.onRelease = function () { if ((_root.username.text != "") && (_root.password.text != "")) { var params = new Object (); params.USERNAME = _root.ud_username.text; params.PASSWORD = _root.securityKey_open.text; // lets pass it to CF!!! _root.srv.login (params, res); // pass the res object and the params array over } else { _root.errorMessage._visible = true; _root.errorMessage.text = "Please completely enter both username and password"; }; }; where srv.login in my code refers to srv = conn.getService("dir_x.dir_y.app", this); // dev server remoting So my Comm App debugger reports that info is being passed, and that CF is returning info...which is good, except now my code does not seem to pick it up. In the code above, I created an object called res...the code for res looks like this in Flash // response Object; res = new Object (); res.onResult = function (result) { // eja: "success" msg indicates whether or not the login was successful. var scs = Boolean (result.success); if (scs) { trace ("eja: connection was a success"); } // end fn } res.onStatus = function (status) { trace ("status=" + status.description); trace ("the onStatus event handler fired"); }; However, I cannot get the onResult event handler fire... (nor the onStatus, I believe). As I said the debugger picks up the response from CF. My CF code that returns the values to Flash is are you wrote in your previous e-mail... Does it have to do with the fact that the name of my var in CF is called fReturn, not res???? Hope you can help me. BTW a lot of the info I have been trying is based on a Flash Remoting MX book, but the code in that book does not seem to work very well. cheers Edward [quoted text, click to view] "Hi_C" <webforumsuser@macromedia.com> wrote in message news:cbdgrq$hb4$1@forums.macromedia.com... > try capitalizing the returned variables from CF. also, for testing purposes > return the entire struct outside of the cfscript tag. > > try this as a test. pass your username and password variables as you listed. > then in your CF function, do this: > > <cfscript> > fReturn=StructNew(); > fReturn.un = FLASH.params[1].username; > fReturn.pw = FLASH.params[1].password; > </cfscript> > <cfreturn fReturn> > > and remember, CF returns variables in CAPS. therefore, to access the returned > variables in your flash return handler you would grab it with the following: > > testUserResult = result.UN; > testPasswordResult = result.PW; > > > if you trace the above flash variables it should spit out the original > username and password variables from your flash app. let me know if this is > still trouble or if you have questions. > > HI_C >
Hi "HI_C" Sorry for the delayed response, I actually tried to respond earlier but the web-based version of the forums seem to be down, so I had to fire up my old news reader to this message. The first thing I have to say is a a Homer Simpson DOH! for not checking for caps. There was two things I did to get the info from Flash to CF - 1. The vars sent from Flash to CF were lower cased in Flash, but I capitalized them in CF and that seemed to work. 2. I sent the info from flash stored within an OBJECT. So, I expected to receive it as a "struct" (?) within CF - however, this is how I passed it.... loginBtn.onRelease = function () { if ((_root.username.text != "") && (_root.password.text != "")) { var params = new Object (); params.USERNAME = _root.ud_username.text; params.PASSWORD = _root.securityKey_open.text; // lets pass it to CF!!! _root.srv.login (params, res); // pass the res object and the params array over } else { _root.errorMessage._visible = true; _root.errorMessage.text = "Please completely enter both username and password"; }; }; where srv.login in my code refers to srv = conn.getService("dir_x.dir_y.app", this); // dev server remoting So my Comm App debugger reports that info is being passed, and that CF is returning info...which is good, except now my code does not seem to pick it up. In the code above, I created an object called res...the code for res looks like this in Flash // response Object; res = new Object (); res.onResult = function (result) { // eja: "success" msg indicates whether or not the login was successful. var scs = Boolean (result.success); if (scs) { trace ("eja: connection was a success"); } // end fn } res.onStatus = function (status) { trace ("status=" + status.description); trace ("the onStatus event handler fired"); }; However, I cannot get the onResult event handler fire... (nor the onStatus, I believe). As I said the debugger picks up the response from CF. My CF code that returns the values to Flash is are you wrote in your previous e-mail... Does it have to do with the fact that the name of my var in CF is called fReturn, not res???? Hope you can help me. BTW a lot of the info I have been trying is based on a Flash Remoting MX book, but the code in that book does not seem to work very well. cheers Edward [quoted text, click to view] "Hi_C" <webforumsuser@macromedia.com> wrote in message news:cbdgrq$hb4$1@forums.macromedia.com... > try capitalizing the returned variables from CF. also, for testing purposes > return the entire struct outside of the cfscript tag. > > try this as a test. pass your username and password variables as you listed. > then in your CF function, do this: > > <cfscript> > fReturn=StructNew(); > fReturn.un = FLASH.params[1].username; > fReturn.pw = FLASH.params[1].password; > </cfscript> > <cfreturn fReturn> > > and remember, CF returns variables in CAPS. therefore, to access the returned > variables in your flash return handler you would grab it with the following: > > testUserResult = result.UN; > testPasswordResult = result.PW; > > > if you trace the above flash variables it should spit out the original > username and password variables from your flash app. let me know if this is > still trouble or if you have questions. > > HI_C >
Hi "HI_C" Sorry for the delayed response, I actually tried to respond earlier but the web-based version of the forums seem to be down, so I had to fire up my old news reader to this message. The first thing I have to say is a a Homer Simpson DOH! for not checking for caps. There was two things I did to get the info from Flash to CF - 1. The vars sent from Flash to CF were lower cased in Flash, but I capitalized them in CF and that seemed to work. 2. I sent the info from flash stored within an OBJECT. So, I expected to receive it as a "struct" (?) within CF - however, this is how I passed it.... loginBtn.onRelease = function () { if ((_root.username.text != "") && (_root.password.text != "")) { var params = new Object (); params.USERNAME = _root.ud_username.text; params.PASSWORD = _root.securityKey_open.text; // lets pass it to CF!!! _root.srv.login (params, res); // pass the res object and the params array over } else { _root.errorMessage._visible = true; _root.errorMessage.text = "Please completely enter both username and password"; }; }; where srv.login in my code refers to srv = conn.getService("dir_x.dir_y.app", this); // dev server remoting So my Comm App debugger reports that info is being passed, and that CF is returning info...which is good, except now my code does not seem to pick it up. In the code above, I created an object called res...the code for res looks like this in Flash // response Object; res = new Object (); res.onResult = function (result) { // eja: "success" msg indicates whether or not the login was successful. var scs = Boolean (result.success); if (scs) { trace ("eja: connection was a success"); } // end fn } res.onStatus = function (status) { trace ("status=" + status.description); trace ("the onStatus event handler fired"); }; However, I cannot get the onResult event handler fire... (nor the onStatus, I believe). As I said the debugger picks up the response from CF. My CF code that returns the values to Flash is are you wrote in your previous e-mail... Does it have to do with the fact that the name of my var in CF is called fReturn, not res???? Hope you can help me. BTW a lot of the info I have been trying is based on a Flash Remoting MX book, but the code in that book does not seem to work very well. cheers Edward [quoted text, click to view] "Hi_C" <webforumsuser@macromedia.com> wrote in message news:cbdgrq$hb4$1@forums.macromedia.com... > try capitalizing the returned variables from CF. also, for testing purposes > return the entire struct outside of the cfscript tag. > > try this as a test. pass your username and password variables as you listed. > then in your CF function, do this: > > <cfscript> > fReturn=StructNew(); > fReturn.un = FLASH.params[1].username; > fReturn.pw = FLASH.params[1].password; > </cfscript> > <cfreturn fReturn> > > and remember, CF returns variables in CAPS. therefore, to access the returned > variables in your flash return handler you would grab it with the following: > > testUserResult = result.UN; > testPasswordResult = result.PW; > > > if you trace the above flash variables it should spit out the original > username and password variables from your flash app. let me know if this is > still trouble or if you have questions. > > HI_C >
Hi "HI_C" Sorry for the delayed response, I actually tried to respond earlier but the web-based version of the forums seem to be down, so I had to fire up my old news reader to this message. The first thing I have to say is a a Homer Simpson DOH! for not checking for caps. There was two things I did to get the info from Flash to CF - 1. The vars sent from Flash to CF were lower cased in Flash, but I capitalized them in CF and that seemed to work. 2. I sent the info from flash stored within an OBJECT. So, I expected to receive it as a "struct" (?) within CF - however, this is how I passed it.... loginBtn.onRelease = function () { if ((_root.username.text != "") && (_root.password.text != "")) { var params = new Object (); params.USERNAME = _root.ud_username.text; params.PASSWORD = _root.securityKey_open.text; // lets pass it to CF!!! _root.srv.login (params, res); // pass the res object and the params array over } else { _root.errorMessage._visible = true; _root.errorMessage.text = "Please completely enter both username and password"; }; }; where srv.login in my code refers to srv = conn.getService("dir_x.dir_y.app", this); // dev server remoting So my Comm App debugger reports that info is being passed, and that CF is returning info...which is good, except now my code does not seem to pick it up. In the code above, I created an object called res...the code for res looks like this in Flash // response Object; res = new Object (); res.onResult = function (result) { // eja: "success" msg indicates whether or not the login was successful. var scs = Boolean (result.success); if (scs) { trace ("eja: connection was a success"); } // end fn } res.onStatus = function (status) { trace ("status=" + status.description); trace ("the onStatus event handler fired"); }; However, I cannot get the onResult event handler fire... (nor the onStatus, I believe). As I said the debugger picks up the response from CF. My CF code that returns the values to Flash is are you wrote in your previous e-mail... Does it have to do with the fact that the name of my var in CF is called fReturn, not res???? Hope you can help me. BTW a lot of the info I have been trying is based on a Flash Remoting MX book, but the code in that book does not seem to work very well. cheers Edward [quoted text, click to view] "Hi_C" <webforumsuser@macromedia.com> wrote in message news:cbdgrq$hb4$1@forums.macromedia.com... > try capitalizing the returned variables from CF. also, for testing purposes > return the entire struct outside of the cfscript tag. > > try this as a test. pass your username and password variables as you listed. > then in your CF function, do this: > > <cfscript> > fReturn=StructNew(); > fReturn.un = FLASH.params[1].username; > fReturn.pw = FLASH.params[1].password; > </cfscript> > <cfreturn fReturn> > > and remember, CF returns variables in CAPS. therefore, to access the returned > variables in your flash return handler you would grab it with the following: > > testUserResult = result.UN; > testPasswordResult = result.PW; > > > if you trace the above flash variables it should spit out the original > username and password variables from your flash app. let me know if this is > still trouble or if you have questions. > > HI_C >
Hi "HI_C" Sorry for the delayed response, I actually tried to respond earlier but the web-based version of the forums seem to be down, so I had to fire up my old news reader to this message. The first thing I have to say is a a Homer Simpson DOH! for not checking for caps. There was two things I did to get the info from Flash to CF - 1. The vars sent from Flash to CF were lower cased in Flash, but I capitalized them in CF and that seemed to work. 2. I sent the info from flash stored within an OBJECT. So, I expected to receive it as a "struct" (?) within CF - however, this is how I passed it.... loginBtn.onRelease = function () { if ((_root.username.text != "") && (_root.password.text != "")) { var params = new Object (); params.USERNAME = _root.ud_username.text; params.PASSWORD = _root.securityKey_open.text; // lets pass it to CF!!! _root.srv.login (params, res); // pass the res object and the params array over } else { _root.errorMessage._visible = true; _root.errorMessage.text = "Please completely enter both username and password"; }; }; where srv.login in my code refers to srv = conn.getService("dir_x.dir_y.app", this); // dev server remoting So my Comm App debugger reports that info is being passed, and that CF is returning info...which is good, except now my code does not seem to pick it up. In the code above, I created an object called res...the code for res looks like this in Flash // response Object; res = new Object (); res.onResult = function (result) { // eja: "success" msg indicates whether or not the login was successful. var scs = Boolean (result.success); if (scs) { trace ("eja: connection was a success"); } // end fn } res.onStatus = function (status) { trace ("status=" + status.description); trace ("the onStatus event handler fired"); }; However, I cannot get the onResult event handler fire... (nor the onStatus, I believe). As I said the debugger picks up the response from CF. My CF code that returns the values to Flash is are you wrote in your previous e-mail... Does it have to do with the fact that the name of my var in CF is called fReturn, not res???? Hope you can help me. BTW a lot of the info I have been trying is based on a Flash Remoting MX book, but the code in that book does not seem to work very well. cheers Edward [quoted text, click to view] "Hi_C" <webforumsuser@macromedia.com> wrote in message news:cbdgrq$hb4$1@forums.macromedia.com... > try capitalizing the returned variables from CF. also, for testing purposes > return the entire struct outside of the cfscript tag. > > try this as a test. pass your username and password variables as you listed. > then in your CF function, do this: > > <cfscript> > fReturn=StructNew(); > fReturn.un = FLASH.params[1].username; > fReturn.pw = FLASH.params[1].password; > </cfscript> > <cfreturn fReturn> > > and remember, CF returns variables in CAPS. therefore, to access the returned > variables in your flash return handler you would grab it with the following: > > testUserResult = result.UN; > testPasswordResult = result.PW; > > > if you trace the above flash variables it should spit out the original > username and password variables from your flash app. let me know if this is > still trouble or if you have questions. > > HI_C >
Hi "HI_C" Sorry for the delayed response, I actually tried to respond earlier but the web-based version of the forums seem to be down, so I had to fire up my old news reader to this message. The first thing I have to say is a a Homer Simpson DOH! for not checking for caps. There was two things I did to get the info from Flash to CF - 1. The vars sent from Flash to CF were lower cased in Flash, but I capitalized them in CF and that seemed to work. 2. I sent the info from flash stored within an OBJECT. So, I expected to receive it as a "struct" (?) within CF - however, this is how I passed it.... loginBtn.onRelease = function () { if ((_root.username.text != "") && (_root.password.text != "")) { var params = new Object (); params.USERNAME = _root.ud_username.text; params.PASSWORD = _root.securityKey_open.text; // lets pass it to CF!!! _root.srv.login (params, res); // pass the res object and the params array over } else { _root.errorMessage._visible = true; _root.errorMessage.text = "Please completely enter both username and password"; }; }; where srv.login in my code refers to srv = conn.getService("dir_x.dir_y.app", this); // dev server remoting So my Comm App debugger reports that info is being passed, and that CF is returning info...which is good, except now my code does not seem to pick it up. In the code above, I created an object called res...the code for res looks like this in Flash // response Object; res = new Object (); res.onResult = function (result) { // eja: "success" msg indicates whether or not the login was successful. var scs = Boolean (result.success); if (scs) { trace ("eja: connection was a success"); } // end fn } res.onStatus = function (status) { trace ("status=" + status.description); trace ("the onStatus event handler fired"); }; However, I cannot get the onResult event handler fire... (nor the onStatus, I believe). As I said the debugger picks up the response from CF. My CF code that returns the values to Flash is are you wrote in your previous e-mail... Does it have to do with the fact that the name of my var in CF is called fReturn, not res???? Hope you can help me. BTW a lot of the info I have been trying is based on a Flash Remoting MX book, but the code in that book does not seem to work very well. cheers Edward [quoted text, click to view] "Hi_C" <webforumsuser@macromedia.com> wrote in message news:cbdgrq$hb4$1@forums.macromedia.com... > try capitalizing the returned variables from CF. also, for testing purposes > return the entire struct outside of the cfscript tag. > > try this as a test. pass your username and password variables as you listed. > then in your CF function, do this: > > <cfscript> > fReturn=StructNew(); > fReturn.un = FLASH.params[1].username; > fReturn.pw = FLASH.params[1].password; > </cfscript> > <cfreturn fReturn> > > and remember, CF returns variables in CAPS. therefore, to access the returned > variables in your flash return handler you would grab it with the following: > > testUserResult = result.UN; > testPasswordResult = result.PW; > > > if you trace the above flash variables it should spit out the original > username and password variables from your flash app. let me know if this is > still trouble or if you have questions. > > HI_C >
i see the forums are back up...good! first off, let me point out that regardless of whether or not your variables in flash are caps or not, coldfusion will return them as caps by default (at least thats what v6.1 does). therefore, your should reference them as caps in flash. next, you are calling the cfc with the result handler and the params object in the wrong place. you need to reverse them. that should take care of your problems. you have: // lets pass it to CF!!! _root.srv.login (params, res); // WRONG should have: // lets pass it to CF!!! _root.srv.login (res, params); // correct hi_c
I seem to be having the same problem. I can get data from CF to Flash MX 2004 but I can't sent "Struct" or "Query" data back to CF from Flash... is there a trick? [quoted text, click to view] "eapostol" <webforumsuser@macromedia.com> wrote in message news:<cbb3t1$bbn$1@forums.macromedia.com>... > Hello - (this is reposted - apologies in advance but not sure if it was > submitted) > > I am running a dev server with CFMX Server 6.1, Flash MX 2004 and Flash > Remoting components. I was testing Flash remoting by creating a simple > username/password authentication app. > > -The form is in flash, with fields called username and password. > -I send them packaged as properties in an object > > var params=new Object(); > params.username=_root.username.text; > params.password =_root.password.text; > > The Flash Comm App Debugger tracks it as it is being passed to the ColdFusion > Page > > MethodName: "xxx.yyy.dev.remoting_study.test_07.login" > Parameters (object #2) > .....[0] (object #3) > .........."[object Object]" > .....[1] (object #4) > ..........password: "1234" > ..........username: "abcd" > > However, once the data is received in the CF page, I cannot seem to "get the > data" using FLASH.params. > > I tried FLASH.params[1].username and FLASH.params[1].password for example, > but I get an "USERNAME is undefined" or "PASSWORD is undefined" when I try to > retrieve them, I have tried passing the data from Flash in various other > fashions > > myService.login(returnObj,params) // orignial > myservice.login(returnObj,param.username,param.password); // another way > myService.login(returnObj,{username:xxxx, password:123 }); // another way > > and also tried alternatives to receiving the data in the ColdFusion > page/service > (a FOR loop to read the array, reading it like a struct() object)...but I keep > on getting the data passed as undefined... > > However, I can set values in the FLASH.params scope in the web page and pass > it from the CF page back to flash, ex. > > <cfscript> > fReturn=StructNew(); > fReturn.status=success; > FLASH.result=fReturn; > // etc > </cfscript> > > Anyone encounter this before??? Long and Short...I can pass the data from > Flash to CF, but the CF does not receive it; I can create and process data from > a CF page and pass it back to Flash. Am I missing something with respect to the > syntax that retrieves the data? All connections, gateways etc. are fine > otherwise. > > Look forward to your responses.... >
Don't see what you're looking for? Try a search.
|
|
|