Flash Unable To Open URL when Application.cfm exists! Why?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • benjaminkang
    New Member
    • Mar 2008
    • 4

    #1

    Flash Unable To Open URL when Application.cfm exists! Why?

    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.cf m"

    Anyone knows how to fix this?

    Application.cfm
    [CODE=cfm]
    <CFPARAM NAME="timeout" DEFAULT="#creat etimespan(0,0,0 ,5)#">
    <!--- With Session Management Enabled --->
    <CFAPPLICATIO N NAME="Flash" SESSIONMANAGEME NT="YES" SETCLIENTCOOKIE S="NO" SESSIONTIMEOUT= "#timeout#" >
    <!--- CF will not set the client cookies automatically, so set them manually as per-session cookies --->
    <CFIF not IsDefined("Cook ie.CFID")>
    <CFLOCK SCOPE="SESSION" TYPE="READONLY" TIMEOUT="5">
    <CFCOOKIE NAME="CFID" VALUE="#SESSION .CFID#">
    <CFCOOKIE NAME="CFTOKEN" VALUE="#SESSION .CFTOKEN#">
    </CFLOCK>
    </CFIF>
    [/CODE]
    The Action Script
    [CODE=actionscri pt]submitURL = "http://192.168.1.6/flash/testing/LoginProcess.cf m";

    //Define function to process form data
    function checkUser():Voi d {
    //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.onLoa d = handleReply;

    // Submit the order data
    dataOut.sendAnd Load(submitURL, replyData, "post");

    }

    function OnReset():Void {
    userinput.text= "";
    passinput.text= "";
    status_txt.text ="";
    }


    function handleReply(suc cess) {
    if (success) {
    if (replyData.repl y_status) {
    gotoAndStop(3);

    }
    else {
    mx.controls.Ale rt.show("Login Failed!", "Alert");
    gotoAndPlay(1);

    }
    }
    else {
    mx.controls.Ale rt.show("There was a problem submitting your login. The server may be down or not responding.", "Alert");

    }
    }[/CODE]

    The LoginProcess.cf m
    [CODE=cfm]
    <cfset LoginName=#Fnam e#>
    <cfset LoginPwd=#Fpwd# >

    <cfquery datasource="#Fl ashDB#" name="CheckLogi n">
    Select *
    From Clients
    Where AccountName='#L oginName#' AND Password='#Logi nPwd#' 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 enablecfoutputo nly="YES">
    <cfcontent type = "applicatio n/x-www-urlform-encoded">

    <cfif CheckLogin.Flas hLogin NEQ True>
    <cfset LoginStatus=1>
    <cfset CurrBalance = #NumberFormat(C heckLogin.Curre ncyBalance*100, '99')#>
    <cfset returnToFlash = "&reply_usernam e=#URLEncodedFo rmat(LoginName) #&reply_pwd= #URLEncodedForm at(LoginPwd)#&r eply_status= #URLEncodedForm at(LoginStatus) #&reply_balance = #URLEncodedForm at(CurrBalance) #&reply_nick= #URLEncodedForm at(CheckLogin.L astName)#&reply _clientID= #URLEncodedForm at(CheckLogin.C lientID)#&abc=1 234">
    <cfelse>
    <cfset LoginStatus=0>
    <cfset returnToFlash = "&reply_usernam e=#URLEncodedFo rmat(LoginName) #&reply_pwd= #URLEncodedForm at(LoginPwd)#">
    </cfif>

    <!--- FlashOutput contains the string that will be sent back to Flash--->
    <cfprocessingdi rective suppresswhitesp ace="Yes">
    <cfoutput>
    #returnToFlash#
    </cfoutput>
    </cfprocessingdir ective>[/CODE]

    Login page, with the flash embedded
    [CODE=html]
    <body>

    <cfoutput>

    <object width="350" height="250">

    <param name="movie" value="Login3.s wf">

    <embed src="Login.swf" width="350" height="250">

    </embed>

    </object>

    </cfoutput>


    </body>
    [/CODE]
    Last edited by acoder; Mar 18 '08, 02:31 PM. Reason: Added languages to code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Maybe the timeout is too low. How long does it take the page to open?

    Comment

    • benjaminkang
      New Member
      • Mar 2008
      • 4

      #3
      well, the page opens almost instantly since its hosted on a local server.

      Comment

      • benjaminkang
        New Member
        • Mar 2008
        • 4

        #4
        ah, my mistake, i just realized that i forgot to cfset datasource.... hahahaha my bad...sorry

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          So why didn't the error message show that?

          Comment

          Working...