Jump to content

question


Ninjakreborn

Recommended Posts

I found out what I needed to find out, I have a quick question.  I am doing something called "flash remoting" in php, but a little different.
What is the best method(he knows actionscript, I don't I only know php).  Here is the thing, I am creating the functions in php.  I create them using php, he is wanting to be able to call those functions from directly inside actionscript.  Like if I set up a function to add new users into a database, in the middle of his actionscript programming logic he wants to be able to call the funciton out of nowhere, and for it to work, and do what it's suppose to do, w hat is the best way to get him to be able to do this.???
Link to comment
Share on other sites

The way they use to do it, is create the functions in php, save all the results as xml.  Pass it to flash's built in xml processor, parse it, cut the information up, use it, package it back as xml, and send it back to php, where you have another xml parser to parse it and do what's necessary.  Called "remote flashing" or "flashing remote" one or the other don't remember which.  In flash there is a function called GetAndLoad() that does all the internal stuff for you, but it doesn't seem to do what he wants.  I need to figure out, does php have something, like passing variables from php, to javascript and back, the same with flash
Link to comment
Share on other sites

[quote author=GingerRobot link=topic=104248.msg415759#msg415759 date=1155589249]
You can parse variables to and from PHP with ajax...
[/quote]
You can send information from the browser to the server via ajax, not necessarily "parsing variables", and it doesn't have to be php on the server.  In fact, it can be plain HTML/text if the programmer wanted.

I don't think that ajax is an option here.  I'm not familiar with actionscript, but my understanding is that the way for the two to communicate is via text files.  They can be either xml, or just a formatted text file that both programmers can then extract the data from.  If the two are running on the same server, then there should be a way for actionscript to execute a php file, even if from the command line.  If they are not on the same server, or even if they are, then he should be able to call the page/function via a url and pass most parameters via the url.  So, if each php "function" was a seperate page, then he would only have to go to http://your.server/phpfunction1.php?var1=something and your "function" would return the results.
Link to comment
Share on other sites

I dont really see there is much differance between passing information and passing variables. I mean, you are going to need to send the contents of the variable, so you can send it to the php script either by post or get, and can retrieve any contents by manipulating the ouput of the php script and then manipulate the response with javascript.
Link to comment
Share on other sites

That's sort of what I mean, but it's in the same page, like if I create (for example) just a simple echo hello world function, he wanted to be able to call that functions without flash, even like 10 times, and those 10 places it outputs hello world, on a site that is done totally in flash, like have php functions usable in flash.
Link to comment
Share on other sites

Using flash as apposed to html is not really that different. At its most basic....

[code=php:0]
function welcome() {
  echo "message=hello%20world&name=foo";
}
if (isset($_GET['action'])) {
  if ($_GET['action'] == 'welcome') {
    welcome();
  }
}
[/code]

As you may see... flash expects to be returned a string much like url perameters. The above example (when requested from flash using scriptname.php?action=welcome) would make available the variables [i]message[/i] and [i]name[/i] to flash.

Of course for more data your probably best looking into passing xml around, but the basic concept is much the same.
Link to comment
Share on other sites

This might help with the process of understanding -> http://www.kirupa.com/developer/actionscript/flash_php_mysql.htm

Before coding anything, I'd make sure you have written down and agreed just what data is going to be sent to each function and in what form, and just what data is to be sent back and in what form. And any 'special' cases that vary from those requirements.  Agreeing before starting may save you both time and money.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.