A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Passing variables from php to flash

  1. #1
    Member
    Join Date
    Jan 2008
    Posts
    31

    Passing variables from php to flash

    Hi there

    I have a problem using a very simple URLVariables script with php
    The thing is this sample do works on some servers and doesn't on other:
    Instead of having the correct values with trace, I get the php code itself.
    That means I get the following string in trace():
    <?php
    $myresult = $_POST['name'];
    echo "the result is ".$myresult;
    ?>
    Here is the php code file called with URLRequest by flash
    Code:
    <?php
    $myresult = $_POST['name'];
    echo "the result is ".$myresult;
    ?>
    Here is the actionscript that should display "the result is: foo"
    Code:
    var urlLoader:URLLoader = new URLLoader();
    
    var urlRequest:URLRequest = new URLRequest("call.php");
    urlRequest.data = new URLVariables("name=foo");
    urlRequest.method = URLRequestMethod.POST;
    
    urlLoader.addEventListener(Event.COMPLETE, dataloaded);
    urlLoader.load(urlRequest);
    
    function dataloaded(e:Event):void
    {
    var myresult = (e.target as URLLoader).data;
    trace(myresult);
    }

    I know it comes from the php configuration on my server because I tested it on another server and it works, but I can’t find what I must change in my php.ini file to get the good results in trace();

    Do you have any idea? thanks

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I am not sure it works though but try changing $myresult= to "myresult="

    echo "myresult";
    Last edited by cancerinform; 02-15-2008 at 11:25 AM.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Jan 2008
    Posts
    31
    I got the solution to my problem: I used the flash IDE whereas I should have called the flash file in my web browser
    thanks

  4. #4
    Junior Member
    Join Date
    Mar 2010
    Posts
    1

    didnt get ur solution

    i m having same prob how u solve it exactly ? i m new in flash ..

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