simpleas3 documentation

Load XML files with loadXML()

Like opening webpages, loading an XML file in ActionScript 3.0 can require a lot more code than one might expect. One must create a URLLoader, a URLRequest, and add multiple event listeners. The global loadXML() function has been added to SimpleAS3 to quickly load an XML file with one function call.

Method Signature

function loadXML( url:String, onCompleteHandler:Function = null,
	onErrorHandler:Function = null ):void

Parameters

Usage Example

loadXML( "data.xml", dataCompleteHandler );

function dataCompleteHandler( xmlData:XML )
{
	trace( xmlData.exampleElement.@exampleAttribute );
}

Return to Documentation