# Actionscript to php and back (working, but...)

**URL:** <https://forum.kirupa.com/t/actionscript-to-php-and-back-working-but/331909>\
**Category:** flash\
**Created:** [November 22, 2013, 8:51pm UTC](https://forum.kirupa.com/t/actionscript-to-php-and-back-working-but/331909 "2013-11-22T20:51:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nightkarnation](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@nightkarnation](https://forum.kirupa.com/u/nightkarnation)\
**Post date:** [November 22, 2013, 8:51pm UTC](https://forum.kirupa.com/t/actionscript-to-php-and-back-working-but/331909/1 "2013-11-22T20:51:00Z")

</div>

Hey guys!  
I have a simple script that sends a variable to php (locally) and then php returns another variable to flash…

Here’s the simple script:

```auto

var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("http://localhost/test/test.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
var varLoader:URLLoader = new URLLoader;
//varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.dataFormat = URLLoaderDataFormat.TEXT;
varLoader.addEventListener(Event.COMPLETE, completeHandler);

variables.action = "submitForm";
varLoader.load(varSend);

function completeHandler(event:Event):void
{
    trace("works");
    trace(event.target.data);
    var checkStatus:String = event.target.data.imdoneUpdate;
    trace(checkStatus);
    if (checkStatus == "1")
    {
        trace("WORKS");
    }
    else
    {
        trace("NEEEEEEH");
    }
    
}

```

PHP CODE:

```auto

$action=$_POST['action'];
if ($action == "submitForm")
{
    $imdoneUpdate = true;
    echo "imdoneUpdate=".$imdoneUpdate;
}

```

flash output:  
works  
imdoneUpdate=1  
ReferenceError: Error #1069: Property imdoneUpdate not found on String and there is no default value.  
at test\_fla::MainTimeline/completeHandler()  
at flash.events::EventDispatcher/dispatchEventFunction()  
at flash.events::EventDispatcher/dispatchEvent()  
at [flash.net](http://flash.net)::URLLoader/onComplete()

As you can see…flash is connecting to php and even the trace for event.target.data is tracing imdoneUpdate=1 …so why event.target.data.imdoneUpdate is not properly working??  
Am I echoing incorrectly through php?

Thanks a lot in advance!
