A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 25

Thread: Pulling data from PHP Error

  1. #1
    Member
    Join Date
    Feb 2007
    Posts
    34

    Question 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.)

  2. #2

  3. #3
    Member
    Join Date
    Feb 2007
    Posts
    34
    Ok heres what ive learnt from your 'help', my URL is right and there is no missing punctuation in my code, next?

  4. #4
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    most likely, your URL is wrong. There is no way to verify unless you show us the data.

  5. #5
    Member
    Join Date
    Feb 2007
    Posts
    34
    if i can type the url into the address bar and it give me the data, then why cant flash?

  6. #6
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    I don't know. You probably made a type-o. What's the actual address to the data?

  7. #7
    Member
    Join Date
    Feb 2007
    Posts
    34
    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;
    }

  8. #8

  9. #9
    Member
    Join Date
    Feb 2007
    Posts
    34
    im testing it locally, but connecting to a external server
    Last edited by Austinl; 07-21-2009 at 04:09 PM.

  10. #10
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    see if removing the request from the first URLLoader call makes any difference.

    PHP Code:
    var loader:URLLoader = new URLLoader ();
    loader.addEventListener(Event.COMPLETEonComplete);
    loader.dataFormat URLLoaderDataFormat.VARIABLES;
    loader.load(request); 

  11. #11
    Member
    Join Date
    Feb 2007
    Posts
    34
    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.

  12. #12
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    did you remove the entire block, I meant to replace the block with the one I included.

  13. #13
    Member
    Join Date
    Feb 2007
    Posts
    34
    the one you included gives the error, removing it takes the error away but then i cannot get any data

  14. #14
    Member
    Join Date
    Feb 2007
    Posts
    34
    *bump* still need help on this please

  15. #15

  16. #16
    Member
    Join Date
    Feb 2007
    Posts
    34
    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.

  17. #17
    Senior Member
    Join Date
    May 2004
    Posts
    226
    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.COMPLETEcompleteHandler);
    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);


  18. #18
    Member
    Join Date
    Feb 2007
    Posts
    34
    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?

  19. #19
    WohOoooooo zompo's Avatar
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    138
    Can you even go to http://www.lkmcomputers.co.uk/flash/lee_flash.php in a browser? I can't :|


    Try out my game http://alpha.bombwar.com - Alphakey: fkaplha

  20. #20
    Member
    Join Date
    Feb 2007
    Posts
    34
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center