Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

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
Expand|Select|Wrap|Line Numbers
  1. <CFPARAM NAME="timeout" DEFAULT="#createtimespan(0,0,0,5)#">
  2. <!--- With Session Management Enabled --->
  3. <CFAPPLICATION NAME="Flash" SESSIONMANAGEMENT="YES" SETCLIENTCOOKIES="NO" SESSIONTIMEOUT="#timeout#" >
  4. <!--- CF will not set the client cookies automatically, so set them manually as per-session cookies --->
  5. <CFIF not IsDefined("Cookie.CFID")>
  6.     <CFLOCK SCOPE="SESSION" TYPE="READONLY" TIMEOUT="5">
  7.         <CFCOOKIE NAME="CFID" VALUE="#SESSION.CFID#">
  8.         <CFCOOKIE NAME="CFTOKEN" VALUE="#SESSION.CFTOKEN#">
  9.     </CFLOCK>
  10. </CFIF>

The Action Script
Expand|Select|Wrap|Line Numbers
  1. submitURL = "http://192.168.1.6/flash/testing/LoginProcess.cfm";
  2.  
  3. //Define function to process form data
  4. function checkUser():Void {
  5.     //Creates an instance of LoadVars to send form data to Coldfusion.
  6.     // creating an Array with LoadVars called dataOut to send the form data as a bulk to Coldfusion.
  7.  
  8.     dataOut = new LoadVars();
  9.  
  10.     //These variables will be the once that will correspond to the variables in Coldfusion.
  11.     dataOut.Fname = userinput.text;
  12.     dataOut.Fpwd = passinput.text;
  13.  
  14.     // Create another LoadVars instance to receive the server's reply
  15.     replyData = new LoadVars();
  16.  
  17.     // Initialize reply variable.
  18.     replyData.reply_username = "";
  19.     replyData.reply_pwd = "";
  20.     replyData.reply_status = "";
  21.     replyData.reply_tokencf ="";
  22.     replyData.reply_ftoken ="";
  23.  
  24.     replyData.onLoad = handleReply;
  25.  
  26.     // Submit the order data
  27.     dataOut.sendAndLoad(submitURL, replyData, "post");
  28.  
  29. }
  30.  
  31. function OnReset():Void {
  32.     userinput.text="";
  33.     passinput.text="";
  34.     status_txt.text="";
  35. }
  36.  
  37.  
  38. function handleReply(success) {
  39.     if (success) {        
  40.         if (replyData.reply_status) {
  41.                         gotoAndStop(3);
  42.  
  43.         }
  44.         else {
  45.             mx.controls.Alert.show("Login Failed!", "Alert");
  46.             gotoAndPlay(1);
  47.  
  48.         }
  49.     }
  50.     else {
  51.         mx.controls.Alert.show("There was a problem submitting your login. The server may be down or not responding.", "Alert");
  52.  
  53.     }
  54. }


The LoginProcess.cfm
Expand|Select|Wrap|Line Numbers
  1. <cfset LoginName=#Fname#>
  2. <cfset LoginPwd=#Fpwd#>
  3.  
  4. <cfquery datasource="#FlashDB#" name="CheckLogin">
  5.     Select * 
  6.     From Clients 
  7.     Where AccountName='#LoginName#' AND Password='#LoginPwd#' AND LoginStatus <> 'True' 
  8.     <!--- this is for web login, not flash login --->
  9.     <!--- AND FlashLogin <> 'True' ***might cause timeout error, if timeout doesnt work*** --->
  10.     <!---AND suspend <> 'True'--->
  11. </cfquery>
  12.  
  13. <cfsetting enablecfoutputonly="YES">
  14. <cfcontent type = "application/x-www-urlform-encoded">
  15.  
  16. <cfif CheckLogin.FlashLogin NEQ True>
  17.     <cfset LoginStatus=1>
  18.     <cfset CurrBalance = #NumberFormat(CheckLogin.CurrencyBalance*100, '99')#>
  19.     <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">
  20. <cfelse>
  21.     <cfset LoginStatus=0>
  22.     <cfset returnToFlash = "&reply_username=#URLEncodedFormat(LoginName)#&reply_pwd= #URLEncodedFormat(LoginPwd)#">
  23. </cfif>
  24.  
  25. <!--- FlashOutput contains the string that will be sent back to Flash--->
  26. <cfprocessingdirective suppresswhitespace="Yes">
  27. <cfoutput>
  28. #returnToFlash#
  29. </cfoutput>
  30. </cfprocessingdirective>


Login page, with the flash embedded
Expand|Select|Wrap|Line Numbers
  1. <body>
  2.  
  3. <cfoutput>
  4.  
  5.         <object width="350" height="250">
  6.  
  7.             <param name="movie" value="Login3.swf">
  8.  
  9.             <embed src="Login.swf" width="350" height="250">
  10.  
  11.             </embed>
  12.  
  13.         </object>
  14.  
  15. </cfoutput>
  16.  
  17.  
  18. </body>
acoder's Avatar
acoder
Site Moderator
11,635 Posts
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?

Reply
benjaminkang's Avatar
benjaminkang
Newbie
4 Posts
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.

Reply
benjaminkang's Avatar
benjaminkang
Newbie
4 Posts
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

Reply
acoder's Avatar
acoder
Site Moderator
11,635 Posts
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?

Reply
Reply
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