scross
16-11-2009, 08:17 AM
Hi There,
I am trying to get a swf file to send variables to a php file and then have the php file return a variable and display it within a dynamic text field however everytime I run it, I get the following error:
TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at OCC_checklist_page_2_fla::MainTimeline/completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
I have no idea how to resolve this issue. Does anyone have any ideas?
php code:
<?php
require_once('../../layer/ws/onWsStart.php');
require_once('../../layer/app/fSessionKey.php');
$sessionKey = 0;
if ( isset( $_POST['operation_id']) && isset($_POST['mission_id']) && isset ($_POST['section_id']) ) {
$studentId = getStudentId();
$sessionKey = randomiseKey( $studentId, $_POST['operation_id'], $_POST['mission_id'], $_POST['section_id'] );
storeKey( $sessionKey, $studentId, $_POST['operation_id'], $_POST['mission_id'], $_POST['section_id'] );
}
print "sessionkey=".$sessionKey;
?>
Actionscript 3.0
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("http://test.flamingcow.com.au/layer/ws/xGenSessionKey.php");
varSend.method = URLRequestMethod.POST;
varSend.data=variables;
var varLoader:URLLoader = new URLLoader();
varLoader.dataFormat=URLLoaderDataFormat.VARIABLES ;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
variables.operation_id="1";
variables.mission_id="1";
variables.section_id="1";
varLoader.load(varSend); //This sends the variables to php
//Step 1. POST variables to Get sessionkey
function completeHandler(event:Event):void{
var sessionVar = event.target.data.sessionkey; //flash variable to hold variable created in php
flash_sessionVar.text=sessionVar; //prints variable taken from php into the dynamic text field in flash
}
I am trying to get a swf file to send variables to a php file and then have the php file return a variable and display it within a dynamic text field however everytime I run it, I get the following error:
TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at OCC_checklist_page_2_fla::MainTimeline/completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
I have no idea how to resolve this issue. Does anyone have any ideas?
php code:
<?php
require_once('../../layer/ws/onWsStart.php');
require_once('../../layer/app/fSessionKey.php');
$sessionKey = 0;
if ( isset( $_POST['operation_id']) && isset($_POST['mission_id']) && isset ($_POST['section_id']) ) {
$studentId = getStudentId();
$sessionKey = randomiseKey( $studentId, $_POST['operation_id'], $_POST['mission_id'], $_POST['section_id'] );
storeKey( $sessionKey, $studentId, $_POST['operation_id'], $_POST['mission_id'], $_POST['section_id'] );
}
print "sessionkey=".$sessionKey;
?>
Actionscript 3.0
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("http://test.flamingcow.com.au/layer/ws/xGenSessionKey.php");
varSend.method = URLRequestMethod.POST;
varSend.data=variables;
var varLoader:URLLoader = new URLLoader();
varLoader.dataFormat=URLLoaderDataFormat.VARIABLES ;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
variables.operation_id="1";
variables.mission_id="1";
variables.section_id="1";
varLoader.load(varSend); //This sends the variables to php
//Step 1. POST variables to Get sessionkey
function completeHandler(event:Event):void{
var sessionVar = event.target.data.sessionkey; //flash variable to hold variable created in php
flash_sessionVar.text=sessionVar; //prints variable taken from php into the dynamic text field in flash
}