Jump to content

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!

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.