Port80 Forums Ilisys Web Hosting Fast Hit Web Hosting

Our Platinum Sponsors:


Go Back   Port80 Forums > Development & Code > Flash & Actionscripting

Reply
 
Thread Tools Display Modes
  #1  
Old 16-11-2009, 08:17 AM
scross scross is offline
Senior Member
AWIA Member
 
Join Date: Nov 2004
Location: Perth
Posts: 246
scross is on a distinguished road
Default TypeError: Error #2007: Parameter text must be non-null.

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
}
__________________
Designer / Budding Academic
www.flamingcow.com.au, Follow Me!
Reply With Quote
  #2  
Old 16-11-2009, 12:24 PM
scross scross is offline
Senior Member
AWIA Member
 
Join Date: Nov 2004
Location: Perth
Posts: 246
scross is on a distinguished road
Default

Ok! A friend fixed the issue and thought I would post the solution for any other newbies such as myself out there needing a helping hand:

removed extraneous line breaks - this is both before *and* after the variable string.
There must be one carriage return at the end. no white space before and there must also be no other text beforehand - I suspect other variable assignments or comments will break it, eg.


print "sessionkey=".$sessionKey;"\r\n";
__________________
Designer / Budding Academic
www.flamingcow.com.au, Follow Me!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +8. The time now is 03:27 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.