-
Pulling data from PHP Error
Error:
Code:
Error opening URL 'http://localhost/lee_flash.php?id=austinl&KEY=3076355f8c3710fe0d446bd4309b0c9c'
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://localhost/lee_flash.php?id=austinl&KEY=3076355f8c3710fe0d446bd4309b0c9c
at Tests1_fla::MainTimeline/frame1()
As3:
Code:
var request:URLRequest = new URLRequest ("http://localhost/lee_flash.php?id=austinl&KEY=3076355f8c3710fe0d446bd4309b0c9c");
var variables:URLVariables = new URLVariables();
request.data = variables;
var loader:URLLoader = new URLLoader (request);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
function onComplete (event:Event):void {
var variables:URLVariables = new URLVariables(event.target.data);
trace (variables)
statusTxt1.text = "Error: " + variables.a_error;
statusTxt2.text = "UserID: " + variables.a_userId;
statusTxt3.text = "First Name: " + variables.a_firstName;
statusTxt4.text = "Rank: " + variables.a_rank;
}
Does anybody know why i get this error and it won't return any of the variables?
Thanks
Austinl
(URL Isn't localhost, but i set it to protect website domain.)
-
http://pat.theorigin.net
-
Ok heres what ive learnt from your 'help', my URL is right and there is no missing punctuation in my code, next?
-
http://pat.theorigin.net
most likely, your URL is wrong. There is no way to verify unless you show us the data.
-
if i can type the url into the address bar and it give me the data, then why cant flash?
-
http://pat.theorigin.net
I don't know. You probably made a type-o. What's the actual address to the data?
-
the data and the address has been changed to a super super simple address, so i cant of got it wrong.
http://www.lkmcomputers.co.uk/lee_flash.php
do keep in mind i have changed the last function to this aswell:
Code:
function onComplete (event:Event):void {
var variables:URLVariables = new URLVariables(event.target.data);
statusTxt1.text = "Error: " + variables.a_a_error;
statusTxt2.text = "UserID: " + variables.a_errorText;
}
-
http://pat.theorigin.net
Are you testing locally or on the server? from within the Flash IDE?
-
im testing it locally, but connecting to a external server
Last edited by Austinl; 07-21-2009 at 04:09 PM.
-
http://pat.theorigin.net
see if removing the request from the first URLLoader call makes any difference.
PHP Code:
var loader:URLLoader = new URLLoader (); loader.addEventListener(Event.COMPLETE, onComplete); loader.dataFormat = URLLoaderDataFormat.VARIABLES; loader.load(request);
-
well, i don't get any more output errors, thanks for that, but i dont recieve any data either, just undefined, what do i do now?
Code:
var request:URLRequest = new URLRequest ("http://www.lkmcomputers.co.uk/lee_flash.php");
var variables:URLVariables = new URLVariables();
request.data = variables;
function onComplete (event:Event):void {
var variables:URLVariables = new URLVariables(event.target.data);
statusTxt1.text = "Error: " + variables.a_error;
statusTxt2.text = "Error Text: " + variables.a_errorText;
}
getData.addEventListener(MouseEvent.CLICK, onComplete);
Just an update of the code so we are on the same page.
-
http://pat.theorigin.net
did you remove the entire block, I meant to replace the block with the one I included.
-
the one you included gives the error, removing it takes the error away but then i cannot get any data
-
*bump* still need help on this please
-
http://pat.theorigin.net
include the block I gave you and try testing on the server.
-
I did some searching about and came with this:
Code:
var request:URLRequest = new URLRequest("http://www.lkmcomputers.co.uk/flash/lee_flash.php");
request.method = URLRequestMethod.GET;
var loader:URLLoader = new URLLoader();
loader.dataFormat = "VARIABLES";
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);
function completeHandler(evt:Event) {
var error = evt.target.data.oo_Error;
var firstname = evt.target.data.oo_Firstname;
var surname = evt.target.data.oo_Surname;
var user = evt.target.data.oo_User;
var bob = evt.target.data.oo_Bob;
trace('Error = ' + error);
trace('Your first name is ' + firstname);
trace('Your surname is ' + surname);
trace('Username is ' + user);
trace('Bob ' + bob);
}
But now it gives me this error
Code:
ReferenceError: Error #1069: Property oo_Error not found on String and there is no default value.
-
PHP Code:
var request:URLRequest = new URLRequest("http://www.lkmcomputers.co.uk/flash/lee_flash.php");
request.method = URLRequestMethod.GET;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);
function completeHandler(evt:Event) {
var data:URLVariables = evt.target.data as URLVariables;
var error = data.oo_Error;
var firstname = data.oo_Firstname;
var surname = data.oo_Surname;
var user = data.oo_User;
var bob = data.oo_Bob;
trace('Error = ' + error);
trace('Your first name is ' + firstname);
trace('Your surname is ' + surname);
trace('Username is ' + user);
trace('Bob ' + bob);
}
-
Code:
Error opening URL 'http://www.lkmcomputers.co.uk/flash/lee_flash.php'
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://www.lkmcomputers.co.uk/flash/lee_flash.php
at Tests2_fla::MainTimeline/frame1()
Do i have to export the published SWF into the server and run it server side?
-
WohOoooooo
-
yeah i can
oo_Error=No&oo_User=Ash&oo_Firstname=Ashley&oo_Sur name=Meadows&oo_Bob=
Ill look into it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|