Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Jul 2007
    Location
    Orlando Florida
    Posts
    20
    Member #
    15537
    I've been digging around for awhile now, looking for any tutorials or information on running a php function from Flash. I'm not using OOP with the PHP, and from what I've read so far, I should be. Everything I'm finding is for MX remoting, and nothing for CS3. I was hoping for a fairly simple solution, and poping up a php file, and then closing it doesn't work for me in the current situation.

    Basically, I was some functions in an external PHP file, run them from Flash, and return the result to the Flash Player. If it's simple, it'll be a miracle, but I'm sure this is going to be a tough one . Thanks in advance for any help.

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    The simplest way to do this is using the LoadVars object.

    Here's an example actionscript:

    Code:
    var loader:LoadVars = new LoadVars();
    var returnData:LoadVars = new LoadVars();
    
    loader.myVariable = "test";
    loader.sendAndLoad("md5.php", returnData, "POST");
    
    loader.onHTTPStatus = function(httpStatus:Number) {
    }
    
    loader.onData = function(dataArray) {
    }
    
    returnData.onLoad = function(success:Boolean) {
    	if (this.error == 1) {
    		trace ("ERROR:" + this.errorMessage);
    	} else {
    		trace(this.returnValue);
    	}
    }
    and md5.php could look something like this:
    PHP Code:
    <?php

    if (isset($_POST['myVariable'])) {
        echo 
    "&returnValue=" md5($_POST['myVariable']);
    } else {
        echo 
    "&error=1&errorMessage=OOPS!!!";
    }

    ?>

  4. #3
    Junior Member
    Join Date
    Jul 2007
    Location
    Orlando Florida
    Posts
    20
    Member #
    15537
    wow, thats easy. You think I would have found that somewhere. Transio, you are the greatest, and now I can keep the remaining hairs in my head.

  5. #4
    Junior Member
    Join Date
    Aug 2007
    Posts
    6
    Member #
    15662
    I use LoadVars and it works well.

    Bruce


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:34 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com