views:

32

answers:

1

Hi I was wondering I could make my flash program take input from an xml file to create various shapes dynamically?

+1  A: 

You need to use the URLLoader class to get the xml data in your application.


var loader:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest();

var xmlURL:String = "http://example.com/data.xml"

loader.addEventListener(Event.COMPLETE , completeHandler );
loader.load(req);


function completeHandler(event:Event):void
{
    trace( event.target.data );// traces your xml content     
    // retrieve your data then use it 
    //for your display methods
    parseXML(event.target.data ); 

}



PatrickS