Jump to content

Flash Array to PHP array


phpfreakjav

Recommended Posts

How do I send a FLASH array into PHP?PLEASE LOOK AT THE CODE.

I have indicated which arrays I want to send to php.

 

mouseMC._visible = false;

var recording = false;
var playing = false;
var index = 0;

var mPosX = new Array();
var mPosY = new Array();

_root.onEnterFrame = function()
{
if(recording)
{
	mPosX[index] = _root._xmouse;
	mPosY[index] = _root._ymouse;

	index++
}
else if (playing)
{
	mouseMC._x = mPosX[index]   <<<<I WANT TO SEND THIS ARRAY TO PHP
	mouseMC._y = mPosY[index]   <<<<I WANT TO SEND THIS ARRAY TO PHP

	index++;
	if(index == mPosX.length)
	{
		Mouse.show();
		_root.mouseMC._visible = false;
	}
}
}

recBtn.onRelease = function()
{
Mouse.show();

_root.mouseMC._visible = false;

_root.recording = true;
_root.playing = false;
_root.index = 0;	

_root.mPosX = new Array();
_root.mPosY = new Array();

}
playBtn.onRelease = function()
{
Mouse.hide();

_root.mouseMC._visible = true;

_root.recording = false;
_root.playing = true;
_root.index = 0;
}
stopBtn.onRelease = function()
{
Mouse.show();

_root.mouseMC._visible = false;

_root.recording = false;
_root.playing = false;
_root.index = 0;
}






Link to comment
https://forums.phpfreaks.com/topic/160207-flash-array-to-php-array/
Share on other sites

This isn't really a php question...

 

as far as php receiving the values, it would receive it via GET or POST method.

 

<?php
  echo "<pre>";
  print_r($_GET); // dump all values in GET array
  print_r($_POST); // dump all values in POST array
?>

 

So your question is how to get flash to send it via GET or POST.  Which makes it a flash question.  Thread moved.

You will probably need to serialize the array, heres a code example

/* You will need to import the following
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import flash.net.URLVariables;
*/


        public function URLVariablesExample() {
            var url:String = "http://www.[yourDomain].com/application.php";
            var request:URLRequest = new URLRequest(url);  //request to send data to
            request.method = URLRequestMethod.POST; //using POST
            var variables:URLVariables = new URLVariables(); //stores your variable
            variables.exampleSessionId = "IDNumber"  //exampleSessionId will be the key in your $_POST array
            variables.exampleUserLabel = "guest";//exampleUserLabel will be the key in your $_POST array
            //you can make up any new property you need in the variables object.
            request.data = variables;
            var loadPHPPage = new URLLoader()
            loadPHPPage.load(request);
            //probably add an even listener to know when its finished processing...or to do something upon a response from php
            //you can also use sentToURL()
        }

cheers!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.