Flash Unable To Open URL when Application.cfm exists! Why?
Question posted by: benjaminkang
(Newbie)
on
March 18th, 2008 03:32 AM
I'm very new to Coldfusion and action script, but due to job requirements, i got allocated the task of developing a cfm page where the user logs in using the embedded swf file and everything was working fine, till i decided to add the Application.cfm file for session variables.
Whenever i remove the application.cfm, everything works fine.But if i add it in again, nothing works again.... *sigh*
Error given out by flash is :
Error opening URL "http://192.168.1.6/flash/testing/LoginProcess.cfm"
Anyone knows how to fix this?
Application.cfm
-
<CFPARAM NAME="timeout" DEFAULT="#createtimespan(0,0,0,5)#">
-
<!--- With Session Management Enabled --->
-
<CFAPPLICATION NAME="Flash" SESSIONMANAGEMENT="YES" SETCLIENTCOOKIES="NO" SESSIONTIMEOUT="#timeout#" >
-
<!--- CF will not set the client cookies automatically, so set them manually as per-session cookies --->
-
<CFIF not IsDefined("Cookie.CFID")>
-
<CFLOCK SCOPE="SESSION" TYPE="READONLY" TIMEOUT="5">
-
<CFCOOKIE NAME="CFID" VALUE="#SESSION.CFID#">
-
<CFCOOKIE NAME="CFTOKEN" VALUE="#SESSION.CFTOKEN#">
-
</CFLOCK>
-
</CFIF>
The Action Script
- submitURL = "http://192.168.1.6/flash/testing/LoginProcess.cfm";
-
-
//Define function to process form data
-
function checkUser():Void {
-
//Creates an instance of LoadVars to send form data to Coldfusion.
-
// creating an Array with LoadVars called dataOut to send the form data as a bulk to Coldfusion.
-
-
dataOut = new LoadVars();
-
-
//These variables will be the once that will correspond to the variables in Coldfusion.
-
dataOut.Fname = userinput.text;
-
dataOut.Fpwd = passinput.text;
-
-
// Create another LoadVars instance to receive the server's reply
-
replyData = new LoadVars();
-
-
// Initialize reply variable.
-
replyData.reply_username = "";
-
replyData.reply_pwd = "";
-
replyData.reply_status = "";
-
replyData.reply_tokencf ="";
-
replyData.reply_ftoken ="";
-
-
replyData.onLoad = handleReply;
-
-
// Submit the order data
-
dataOut.sendAndLoad(submitURL, replyData, "post");
-
-
}
-
-
function OnReset():Void {
-
userinput.text="";
-
passinput.text="";
-
status_txt.text="";
-
}
-
-
-
function handleReply(success) {
-
if (success) {
-
if (replyData.reply_status) {
-
gotoAndStop(3);
-
-
}
-
else {
-
mx.controls.Alert.show("Login Failed!", "Alert");
-
gotoAndPlay(1);
-
-
}
-
}
-
else {
-
mx.controls.Alert.show("There was a problem submitting your login. The server may be down or not responding.", "Alert");
-
-
}
-
}
The LoginProcess.cfm
-
<cfset LoginName=#Fname#>
-
<cfset LoginPwd=#Fpwd#>
-
-
<cfquery datasource="#FlashDB#" name="CheckLogin">
-
Select *
-
From Clients
-
Where AccountName='#LoginName#' AND Password='#LoginPwd#' AND LoginStatus <> 'True'
-
<!--- this is for web login, not flash login --->
-
<!--- AND FlashLogin <> 'True' ***might cause timeout error, if timeout doesnt work*** --->
-
<!---AND suspend <> 'True'--->
-
</cfquery>
-
-
<cfsetting enablecfoutputonly="YES">
-
<cfcontent type = "application/x-www-urlform-encoded">
-
-
<cfif CheckLogin.FlashLogin NEQ True>
-
<cfset LoginStatus=1>
-
<cfset CurrBalance = #NumberFormat(CheckLogin.CurrencyBalance*100, '99')#>
-
<cfset returnToFlash = "&reply_username=#URLEncodedFormat(LoginName)#&reply_pwd= #URLEncodedFormat(LoginPwd)#&reply_status= #URLEncodedFormat(LoginStatus)#&reply_balance= #URLEncodedFormat(CurrBalance)#&reply_nick= #URLEncodedFormat(CheckLogin.LastName)#&reply_clientID= #URLEncodedFormat(CheckLogin.ClientID)#&abc=1234">
-
<cfelse>
-
<cfset LoginStatus=0>
-
<cfset returnToFlash = "&reply_username=#URLEncodedFormat(LoginName)#&reply_pwd= #URLEncodedFormat(LoginPwd)#">
-
</cfif>
-
-
<!--- FlashOutput contains the string that will be sent back to Flash--->
-
<cfprocessingdirective suppresswhitespace="Yes">
-
<cfoutput>
-
#returnToFlash#
-
</cfoutput>
-
</cfprocessingdirective>
Login page, with the flash embedded
-
<body>
-
-
<cfoutput>
-
-
<object width="350" height="250">
-
-
<param name="movie" value="Login3.swf">
-
-
<embed src="Login.swf" width="350" height="250">
-
-
</embed>
-
-
</object>
-
-
</cfoutput>
-
-
-
</body>
|
|
March 18th, 2008 02:37 PM
# 2
|
Re: Flash Unable To Open URL when Application.cfm exists! Why?
Maybe the timeout is too low. How long does it take the page to open?
|
|
March 19th, 2008 01:09 AM
# 3
|
Re: Flash Unable To Open URL when Application.cfm exists! Why?
well, the page opens almost instantly since its hosted on a local server.
|
|
March 19th, 2008 09:31 AM
# 4
|
Re: Flash Unable To Open URL when Application.cfm exists! Why?
ah, my mistake, i just realized that i forgot to cfset datasource.... hahahaha my bad...sorry
|
|
March 19th, 2008 11:47 AM
# 5
|
Re: Flash Unable To Open URL when Application.cfm exists! Why?
So why didn't the error message show that?
Not the answer you were looking for? Post your question . . .
189,939 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|
|
|
Latest Articles: Read & Comment
Top Coldfusion Forum Contributors
|