On May 18, 2006, at 7:45 AM, j.c.wichman wrote:
Look at this one for example
http://www.flash-db.com/services/tutorials/mxclasses/
mxwebservices.php?page=
2
The example is correct except for the very first line (drop the "php"
at the very beginning). I've been working with services for the past
few months, and the code example above is the foundation for every
call I make.
You DON'T need the webService component(s) because you're using this
line instead:
import mx.services.*;
As for your ideas for jumping in and out of XML: don't. Web services
are an advanced form of XML that you don't need to dumb down. They
allow you to pass full objects, meaning you only need to transfer one
object to get all the values.
So in the example listed earlier, you would have:
stockResultObj.onResult = function(result) {
myObject = result;
}
And that's it -- all of the object's values are passed using one line
of code. Then you could grab values anytime:
trace(myObject.company); // displays the value for "company"
If you're dealing with multiple objects, or an array of objects you use:
// multiple objects example
myFirstObject = result.MyFirstObject
myNextObject = result.MyNextObject
and/or
// array example
for (i=0; i < result.length; i++) {
myArray[i] = result[i];
}
bonus: don't forget to add the WSDL to your Web Services panel/list
in Flash. This will allow you to easily view all value names and
types being passed in an easy to read format.
-radley
------------------------------------------------------------------------
------
Radley Marx
[EMAIL PROTECTED]
310.220.4088
http://www.radleymarx.com
------------------------------------------------------------------------
------
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com