Hi d00ds,
I have a array that gets passed straight into this function
function handleResult(re : ResultEvent)
{
QuestionSet = re.result;
trace(QuestionSet[0]['Question']);
}
Now I wan’t to take the ‘QuestionSet’ array out of this function and expose it on the first frame (or on the _root. domain) so I can call it from OUTSIDE the function. So for example:
function handleResult(re : ResultEvent)
{
QuestionSet = re.result;
trace(QuestionSet[0]['Question']); //this works
}
trace(QuestionSet[0]['Question']); //this doesnt work, but i want it to work!!
Now I’ve tried declaring _global variables, with no luck!:
function handleResult(re : ResultEvent)
{
QuestionSet = re.result;
_global.Question = QuestionSet
trace(_global.Question[0]['Question']); //this works
}
trace(_global.Question[0]['Question']); //this doesn't work.
Any ideas??
Oh and another note:
I can’t use the ‘return’ line in the function because it still doesnt work because what I use is AMFPHP and that takes al my variables from my PHP and straight inserts them into the above function. This is the whole code:
stop();
import mx.remoting.*;
import mx.rpc.*;
import mx.remoting.debug.NetDebug;
var gatewayUrl:String = "http://localhost/flashservices/gateway.php"
NetDebug.initialize();
var _service:Service = new Service(gatewayUrl, null, 'HelloWorld', null , null);
var pc:PendingCall = _service.say("Hello world!");
pc.responder = new RelayResponder(this, "handleResult", "handleError");
function handleResult(re : ResultEvent)
{
QuestionSet = re.result;
_global.Question = QuestionSet
trace(_global.Question[0]['Question']);
}
function handleError(fe:FaultEvent)
{
trace('There has been an error');
}
I can’t just return the array because first i need to PUT IN the array in order to return it from the function which defeats the purpose!