I canβt accept Variable data, I seem to be doing everything right, referring to Adobe AS3 directories, I think this is a problem with PHP, but I'm not sure.
PHP - this file is in the same directory as the AS3 file
<?php $testData = 4; echo "testData=" . $testData ?>
AS3
public function URLLoaderDataFormatExample() { var request:URLRequest = new URLRequest("PHPTest.php"); var variables:URLLoader = new URLLoader(); variables.dataFormat = URLLoaderDataFormat.VARIABLES; variables.addEventListener(Event.COMPLETE, completeHandler); try { variables.load(request); } catch (error:Error) { trace("Unable to load URL: " + error); } } private function completeHandler(event:Event):void { var loader:URLLoader = URLLoader(event.target); trace(event.target.data.testData) }
The trace statement should print 4. However, it just prints undefined.
source share