[SOLVED] I don't see the fault

02-19-08, 04:38 AM
|
|
Code Guru
|
|
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
[SOLVED] I don't see the fault
Hi there...
what is wrong about this AS? The only way to make it work is to change sendAndLoad to send. .But then a new broswer is opened. That's not what I want..!
ActionScript Code:
emaileen = "mymail@mysite.com"; lvOutt = new LoadVars(); lvInn = new LoadVars(); lvOutt.email = emaileen; lvOutt.format = "h"; lvOutt.sendAndLoad("http://www.url.com/news/sendform.php?formnr=6", lvInn, "POST");
this line of code is in the same script (a bit above the fault part) and is working fine:
ActionScript Code:
lvOut = new LoadVars(); lvIn = new LoadVars(); lvOut.action = "geefReactie"; lvOut.email = txt.text; emaileen = lvOut.email; lvOut.nrone = dataone; lvOut.nrtwo = datatwo; lvOut.sendAndLoad("check.php", lvIn, "POST");
the only difference that I see is:
the url is on another domain in the "fault part" but this shouldn't be a problem is it?..
_j
Last edited by UnrealEd; 02-19-08 at 01:52 PM.
Reason: please use the [highlight=ActionScript] wrapper when posting actionscript code
|

02-19-08, 05:14 AM
|
|
Code Guru
|
|
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
another wierd thing:
as a test it local from my computer it works fine.. as soon as I
put it on my website it doesn't work..
_j
|

02-19-08, 02:02 PM
|
 |
Community Liaison
|
|
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
|
|
the reason why it might not be working is because of a security setting of flash itself. When connecting to a remote host (ip) through the flash application, you need to approve that connection first.
Go to this url:
http://www.macromedia.com/support/do...manager04.html
And select "Add location..." from the "Edit locations" dropdown. Now add that reffers to your swf on your server, and hit "confirm". Refresh your flash application and test it again
Also: are you using the lvInn variable? If not, simply remove it as it is obsolete. You can pass on 2 parameters into the sendAndLoad method (the url, and the method), and it will still work
Just a note: it is best to declare the type of the variable as well. This is done by adding a colon after the name of the variable and then the name of the type. So a LoadVars object declaration should look like this:
ActionScript Code:
var lvOut:LoadVars = new LoadVars();
I'm not sure if this has any advantage, but is defenitely nice when you start creating classes in which you need to declare the fields before you can assign a value to them
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks
|

02-20-08, 04:00 AM
|
|
Code Guru
|
|
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
okay.. it took a looK at the URL.
is this "security" setting is client side.. ? if it is, is there a way to work arround this?.
so that everybody can use swf on my website?..
|

02-21-08, 04:03 AM
|
 |
Community Liaison
|
|
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
|
|
This is indeed a client-side setting. So all visitors will need to approve the application.
I don't know if there's a workaround via flash, but I sure know there's a workaround using php. Instead of submitting the form to http://www.url.com/news/sendform.php?formnr=6, submit it to a page on your server (which is localhost for the flash application), and then submit the form, using php, to http://www.url.com/news/sendform.php?formnr=6. Grab the results, and send them back to flash. It's very easy, since you allready have the mechanism up and running. You just need to create a new page that will send the request to the correct page.
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks
|

02-21-08, 05:35 AM
|
|
Code Guru
|
|
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
okay.. I'll give this a try... do you know how to
submit a form automaticly..
because actually I don't want an extra page to be seen.
So the data should be submitted but the page not changed...
you got what I mean?.
_j
|

02-21-08, 08:50 AM
|
 |
Community Liaison
|
|
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
|
|
yup. It's actually pretty easy. You can either use cURL, or create a socket connection to the http://www.url.com/news/sendform.php?formnr=6 script.
Here's an example on how to do it with cURL:
a socket example:
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks
|

02-27-08, 02:29 AM
|
|
Code Guru
|
|
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
shouldn't there be .php in this line?
sot that is goes:
|

02-28-08, 06:58 AM
|
 |
Community Liaison
|
|
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
|
|
Oops, my mistake
Also: you should replace "Content-Legnth" by "Content-Length", another typo 
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks
|

02-28-08, 09:38 AM
|
|
Code Guru
|
|
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
this past cause an error:
if I delete this part the page is loaded good. What does this part do and what can be the error?..
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|