[swx] Problem saving swx returned object
holger arndt
holger.arndt at synap.de
Thu Apr 24 13:24:41 PDT 2008
Hi Robert,
as you can read below, i have worked on that problem a while
and found a clue to what the problem might be.
And i have found a radical solution :-)
So the object that is returned to a SWXcallback is an Object but the
result property is not...or better no quite :-)
To Flash it is an object because typeof(e.result) rturns the String
"object"
But when using strict typing, as you can read below, e.result is NOT
an Object
And the instanceof function also returns false...
So what to do...?
go into the class org.swxformat.SWX
and find the function "arrayToJson"
this is called for preparing the args-Array.
Within it you will find that Aral used the
"x instanceof Object"
function to see if a parameter is indeed an Object
when you change this to
typeof x = "object"
it works fine and you can send resultObjects directly as args again
So before you jump ahead, i want you to notice that you change
sourceCode that's not yours.
OK, now go ahead ;-)
Greets,
Holger Arndt
************EARLIER**************
so far I can only confirm that there is indeed a problem with using
the result object of SWX.call as an argument
within the result handler.
i constructed a simple call to a method like yours on the server side,
which only returns the object itself
and just used the result property as the args parameter for the second
call to just the same method and it returns null.
So I'm trying to figure out, what the problem is but it seems that
it's noting special to your script...
A clue to the problem might be that e.result is not seen as an Object
in Flash (see below):
var example = {name:"senseless"};
trace(example.constructor==Object);//true
But in the callback function:
function resultHandlerFromSwx(e:Object){
trace(e.constructor==Object); //true
trace(e.result.constructor==Object); //false
}
And when pass the result property directly to a function that strictly
accepts only Objects, i get a compiler error...
function resultHandlerOne(e:Object){
echo(e.result);
}
function echo(result:Object){
//error : type mismatch
}
If i use strict typing to MovieClip, it passes without error...
******************************************
I HAD TO CANCEL THE REST OF THE MESSAGES OR THE MAILER WOULDNT ACCEPT
IT....
More information about the swx
mailing list