PDA

Click to See Complete Forum and Search --> : using loadVars() with ColdFusion .CFM files?



bluntskunk
03-05-2004, 02:53 PM
Hi, I don't know if this is the correct forum to be asking this question or not, but hopefully somebody can help or at least tell me where I should go to find an answer.

Anyways, here goes:

(I am a long-time ColdFusion programmer and getting my feet wet in Flash.)

How in the heck do I use the loadVars() object to load variables from a ColdFusion .cfm file? I do know how to use loadVars() and load/sendAndLoad/etc to load variables from a static file liek a .htm/html/txt and can get that to work just fine. My problem comes as soon as I point to a .cfm file.

This is my first attempt. I'm building a simple login screen right now. When the user enters their username and password, I would like it to pass them to a login script, but whenever I point it at a .cfm file, I get nothing back. even when there is no processing going on in the .cfm file - i simply put login=yes& (which works great in html files using the same method) - it still doesn't work.

is this somethign particular to cfm files? i'm running short on patience with this because i can usually figure this kind of thing out myself no problem and Flash & ColdFusion are both macromedia products so if any two things should work together effortlessly, it should be them.

I am using FlashMX and CF5

I am aware of the Remoting functions in CFMX but I am currently developing in a previous version of CF since it is what my workplace uses.. so i don't have Remoting available.. but it should be possible regardless, no?

someone please help.

thanks a bunch,
jch

vesa kortelainen
03-18-2004, 10:22 AM
jch,

you should have in your I-call-this.cfm file somekind of output, just "Login=yes" wont work.


<cfoutput>login=yes</cfoutput>

See this article for "basics" :How to pass variables to Flash.. (http://www.flash-db.com/Board/index.php?board=19;action=display;threadid=3062)

I hope i made myself clear..

bluntskunk
03-18-2004, 10:52 AM
hrmm... works fine for me though.

when i load variables from a text file, the way my returned variables are formated are like:

login=yes&firstname=joe&lastname=smith& ... etc

this is standard url-encoded variable format. this has always worked for me from text files. the problem was getting the same functionality from a .cfm file, which is what this work-around fixes. go ahead and try it. it works!

:mrpimp:

vesa kortelainen
03-19-2004, 04:38 AM
data.cfm:
login=yes&

as:
myData = new LoadVars()
myData.load("data.cfm")
myData.onLoad = function(succes){
if(succes){
trace( "data loaded from cfm-file:" +this.login );
} else trace ("Error loading data")
}

Does it work?

bluntskunk
03-19-2004, 08:43 AM
oh! hey im so sorry. i thought i was responding to a different thread. i have already solved the problem of using CFM files with the LoadVars.load function.

here is a link to the resolution i posted on macromedia's website:
(my name on that site is GenuineArticle)


http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=294&threadid=789189

sorry for the confusion :D