Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash code logic problem

Status
Not open for further replies.

ChrisMc

Programmer
Apr 24, 2002
43
GB
I commissioned a website and a program to connect and pass parameters to it. The programmer has gone walkabout and, although I (and a website guy who is helping) have the source code, neither of us know Flash.

The problem is that the program should connect to the "processupdate.php" when passed the following parameters (delimited with spaces):

[tt] SAGAXPAPJV 1.13 C:\TEST\CONTROL\UPGRADE\ [/tt]

but it doesn't. We feel that the problem lies in this chunk of code - can anybody point us to the problem?

Many thanks for ANY assistance,
Chris McNab
============================== the suspect code ==========================
Code:
fscommand("flashstudio.cmdparameters", "\"1\",cparam1");
fscommand("flashstudio.cmdparameters", "\"2\",cparam2");
fscommand("flashstudio.cmdparameters", "\"3\",cparam3");
fscommand("flashstudio.cmdparameters", "\"4\",cparam4");

waittime=0;
this.onEnterFrame=function()

{
            waittime++;
            if(waittime>60) 
            {
                        this.onEnterFrame="";
                        if (cparam1.indexOf("@")>0)
                        {
                                    body="";
                                    attachments=cparam3;
                                    cparam2=cparam2.findreplace("_"," ");
                                    fscommand("flashstudio.sendmail_clientside", "cparam1,cparam2,body,attachments");
                                    fscommand("flashstudio.exit");
                        }

                        else

                        {
                                    if(cparam2.length==10)
                                    {
                                                if (cparam1.toLowerCase()=="[URL unfurl="true"]http://www.targetsoftware.co.uk/support/")[/URL] address="[URL unfurl="true"]http://www.targetsoftware.co.uk/support.php?cs="+cparam2;[/URL]

                                                else if (cparam1.toLowerCase()=="[URL unfurl="true"]http://www.targetsoftware.co.uk/orders/")[/URL] address="[URL unfurl="true"]http://www.targetsoftware.co.uk/orders.php?cs="+cparam2;[/URL]

                                                else if (cparam1.toLowerCase()=="[URL unfurl="true"]http://www.targetsoftware.co.uk/update/")[/URL] address="[URL unfurl="true"]http://www.targetsoftware.co.uk/processupdate.php?cs="+cparam2+"?vn="+cparam3+"?path="+cparam4;[/URL]

                                                else address="[URL unfurl="true"]http://www.targetsoftware.co.uk/index.php?cs="+cparam2;[/URL]

                                    getURL(address,"_blank");

                                    fscommand("flashstudio.exit");

                                    }

                                    else

                                    {
                                                getURL("[URL unfurl="true"]http://www.targetsoftware.co.uk","_blank");[/URL]
                                                fscommand("flashstudio.exit");
                                    }
                        }
            }
}

stop();
 
The string of parameters in the query string should be connected with '&' not '?' - the question mark should only appear once in the string. Try this:

Code:
fscommand("flashstudio.cmdparameters", "\"1\",cparam1");
fscommand("flashstudio.cmdparameters", "\"2\",cparam2");
fscommand("flashstudio.cmdparameters", "\"3\",cparam3");
fscommand("flashstudio.cmdparameters", "\"4\",cparam4");
waittime = 0;
this.onEnterFrame = function() {
	waittime++;
	if (waittime>60) {
		this.onEnterFrame = "";
		if (cparam1.indexOf("@")>0) {
			body = "";
			attachments = cparam3;
			cparam2 = cparam2.findreplace("_", " ");
			fscommand("flashstudio.sendmail_clientside", "cparam1,cparam2,body,attachments");
			fscommand("flashstudio.exit", "");
		} else {
			if (cparam2.length == 10) {
				if (cparam1.toLowerCase() == "[URL unfurl="true"]http://www.targetsoftware.co.uk/support/")[/URL] {
					address = "[URL unfurl="true"]http://www.targetsoftware.co.uk/support.php?cs="+cparam2;[/URL]
				} else if (cparam1.toLowerCase() == "[URL unfurl="true"]http://www.targetsoftware.co.uk/orders/")[/URL] {
					address = "[URL unfurl="true"]http://www.targetsoftware.co.uk/orders.php?cs="+cparam2;[/URL]
				} else if (cparam1.toLowerCase() == "[URL unfurl="true"]http://www.targetsoftware.co.uk/update/")[/URL] {
					address = "[URL unfurl="true"]http://www.targetsoftware.co.uk/processupdate.php?cs="+cparam2+"&vn="+cparam3+"&path="+cparam4;[/URL]
				} else {
					address = "[URL unfurl="true"]http://www.targetsoftware.co.uk/index.php?cs="+cparam2;[/URL]
				}
				getURL(address, "_blank");
				fscommand("flashstudio.exit", "");
			} else {
				getURL("[URL unfurl="true"]http://www.targetsoftware.co.uk",[/URL] "_blank");
				fscommand("flashstudio.exit", "");
			}
		}
	}
};
stop();
 
Thanks for taking the time, Wangbar. Doesn't seem to have changed anything but I appreciate the tip.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top