Last active
December 20, 2015 04:58
-
-
Save romaimperator/6074280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flash.events.Event; | |
import flash.net.URLLoader; | |
var XML_URL:String = "http://yourdomainwithxml/"; | |
var myLoader:URLLoader; | |
var myXML:XML = new XML(); | |
function xmlLoaded(event:Event):void | |
{ | |
myXML = XML(myLoader.data); | |
trace("Data loaded."); | |
} | |
function load_external_xml_from_url(url:String) | |
{ | |
myLoader = new URLLoader(new URLRequest(url)); | |
myLoader.addEventListener(Event.COMPLETE, xmlLoaded); | |
} | |
function add_field_to_form(tf:TextField) | |
{ | |
this.addChild(tf); | |
} | |
function create_field_with_text(text:String) | |
{ | |
var tf = new TextField(); | |
tf.text = text; | |
return tf; | |
} | |
//load_external_xml_from_url(XML_URL); | |
myXML.onLoad = function(success) { | |
if (success) { | |
for each (var specialization in myXML) | |
{ | |
for each (var doctor in specialization) | |
{ | |
add_field_to_form(create_field_with_text(doctor.name)); | |
add_field_to_form(create_field_with_text(doctor.office_number)); | |
} | |
} | |
} | |
} | |
myXML.load(XML_URL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment