Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 376

Programming actionscript 3.0
Table of Contents

Advertisement

The following code demonstrates how setting the
URLLoaderDataFormat.VARIABLES
URLVariables object:
package
{
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
public class URLLoaderDataFormatExample extends Sprite
{
public function URLLoaderDataFormatExample()
{
var request:URLRequest = new URLRequest("http://
www.[yourdomain].com/params.txt");
var variables:URLLoader = new URLLoader();
variables.dataFormat = URLLoaderDataFormat.VARIABLES;
variables.addEventListener(Event.COMPLETE, completeHandler);
try
{
variables.load(request);
}
catch (error:Error)
{
trace("Unable to load URL: " + error);
}
}
private function completeHandler(event:Event):void
{
var loader:URLLoader = URLLoader(event.target);
trace(loader.data.dayNames);
}
}
}
The default value for
376
Networking and Communication
allows you to automatically parse loaded data into a
URLLoader.dataFormat
URLLoader.dataFormat
is
URLLoaderDataFormat.TEXT
property to
.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents