Category Archives: HTTPService

Dynamically loading XML files using the HTTPService tag

In previous examples, “Creating a simple image gallery with the Flex TileList control” and “Creating a simple image gallery with the Flex HorizontalList control”, we saw how you could create a simple image gallery using the TileList and HorizontalList controls.

The following example shows how you can load XML files using the HTTPService tag so that you can dynamically load different galleries.

Full code after the jump.

Continue reading Dynamically loading XML files using the HTTPService tag

Passing parameters to an HTTPService

The followig example shows how you can pass parameters to an HTTPService by passing an Object in the HTTPService’s send() method. The remote ColdFusion script is a simple “hello world” type script which accepts a single parameter, “name”, and returns a single parameter, “welcomeMessage”.

Full code after the jump.

Continue reading Passing parameters to an HTTPService

Converting XML to objects using the Flex SimpleXMLDecoder class

Similar to the previous post, “Converting XML to objects using the Flex HTTPService MXML tag“, the following example shows how you can use the decodeXML() method in the SimpleXMLDecoder class to convert an XMLDocument object into an ActionScript Object object.

Full code after the jump.

Continue reading Converting XML to objects using the Flex SimpleXMLDecoder class

Using HTTPService tag to send/receive variables to a server-side script

The following example demonstrates a very simple usage of sending parameters from Flex to a server-side script (written in ColdFusion) and then displaying the server response in our Flex application. The server-side script is a simple echo/”Hello world” type script, but it accepts URL or FORM variables, so you can send using the GET or POST HTTP-method.

It’s a pretty basic/crude example, but maybe it helps somebody out there.

Full code after the jump.

Continue reading Using HTTPService tag to send/receive variables to a server-side script

Dynamically creating ActionScript cue points from FlashVars loaded using the HTTPService tag

In a previous post, “Dynamically creating ActionScript cue points from FlashVars received from the HTML container”, we looked at how to create ActionScript cue points based on variables passed in to our Flex application from the HTML template’s “FlashVars” parameter. In this post we look at a similar approach, although using the <mx:HTTPService /> tag to load cue points from an external file of name/value pairs. This example could easily be extended further to pass a variable to a server-side script which would grab cue point information from a database and pass it back into Flex either as a string of name/value pairs, or as an XML document.

Full code after the jump.

Continue reading Dynamically creating ActionScript cue points from FlashVars loaded using the HTTPService tag

Loading XML at run-time using the mx:HTTPService tag

In the previous post we looked at how to load an XML document in at compile-time and have it embedded in our Flex application. But that technique really only works if the XML data in question never changes. What if you had an XML document that was constantly changing on a daily, or hourly, basis. For example, consider an RSS reader application. If the XML was loaded and embedded in the XML document at compile-time, the RSS would never get updated. And while that may be good in some cases (such as a kiosk, or somewhere without an internet connection where you wanted to display static information), in many cases it may not work.

So, lets take a look at using the mx:HTTPService tag to dynamically load an XML file.

Continue reading Loading XML at run-time using the mx:HTTPService tag