Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Flash (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 17th, 2006, 09:17 AM
Friend of Wrox
 
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP Flash communicatie

Hi,

I need to get data from a database using PHP. Then I want to send this data to flash. To get this data to flash I Know that you can send the variables into the URL. Is this the only way to send data from php to flash.

Thnx

__________________________________________________ ________
This is my junk I'm gona eat it
 
Old May 17th, 2006, 10:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Look into using the LoadVars sendAndLoad method, here is s quick sample.

//create LoadVars Variables
var result_lv:LoadVars = new LoadVars();
var send_lv:LoadVars = new LoadVars();

//this is what you want to send to the PHP file
send_lv.YOUR_FORMFIELDNAME = "Whatever_You_Need_To_Send";

//this is where the items are returned from php file
result_lv.onLoad = function(success:Boolean) {
if (success) {
    trace(this.return_info_01);
    trace(this.return_info_02);
    trace(this.return_info_03);
}

//this sends the information to the PHP file, you can also use the GET method
send_lv.sendAndLoad("http://www.website/your_php_file.php", result_lv, "POST");


YOUR PHP FILE SHOULD RECEIVE AND RETURN THIS FORMAT

<?php
//retrieve infor from flash using POST method
$myVar = $_POST['YOUR_FORMFIELDNAME'];

//any processing code you need to do.

echo "&return_info_01=" . urlencode("send_to_flash_01") . "&return_info_02=" . urlencode("send_to_flash_02") . "&return_info_03=" . urlencode("send_to_flash_03");
?>
//warning: any extra return carriages here will be added to the end of the return string


mike
 
Old May 18th, 2006, 04:18 AM
Friend of Wrox
 
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thnx harpua,

Ill try your code

__________________________________________________ ________
This is my junk I'm gona eat it





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to modify flash so it pulls php url every 15 s method Flash (all versions) 4 February 27th, 2007 06:19 PM
PHP Mysql with Flash based display robprell Beginning PHP 0 November 3rd, 2005 10:06 PM
flash php mail xeno Flash (all versions) 1 July 9th, 2005 04:45 PM
flash and PHP.. somebody please help Stevie Flash (all versions) 2 May 20th, 2005 05:21 PM
PHP varibles in FLASH Ashleek007 Beginning PHP 1 November 30th, 2004 12:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.