I'm still in the beginner's stage of learning AS 3.0, so bear with me...
I've got a very simple file with a dynamic text box that I want an external XML file to load into. I know I'm missing one piece in the code following, but I don't know what it is. Any help is appreciated. thanks.
(fyi, the instance name of the text box is "output_txt" and the XML file is "articleInformation.xml")
//This creates a new instance of the URLrequest object with
//the path to the XML file.
var my_req:URLRequest=new URLRequest("articleInformation.xml");
//This creates a new instance of the loader object.
var my_loader:URLLoader = new URLLoader();
//The XML is saved in the variable my_xml.
var my_xml:XML;
//Event listener to listen to when the XML file has finised loading.
my_loader.addEventListener(Event.COMPLETE, xmlLoader);
my_loader.load(my_req);
function xmlLoader(event:Event):void {
//This parses the XML data.
my_xml=new XML(my_loader.data);
setupoutput_txt();
}
}
Hey RobbieC,
I just amended the prior code to be able to parse your xml. All you have to do is paste in this code on the demo above and be sure to add in your textfields.
Actionscript Code:
var my_req:URLRequest=new URLRequest("articleInformation.xml"); //PUT IN YOUR XML SOURCE HERE var my_loader:URLLoader = new URLLoader(); var my_xml:XML;
hey guys i manage to do the above thing but my problem is that it only shows some part of the text. what i mean is that on the dynamic textbox its suppose to display "article one" but what it does is only display "ee e"
what is causing this?
This could be a result of not embedding certain characters of the particular font you are using.
Try this:
1. Click on the dynamic textbox.
2. In the PROPERTIES window you should see a section called "CHARACTER". Click on "Character Embedding..."
3. Select "All" and hit okay. If you are worried about file size, then you should select individual characters sets to embed.
4. Test that out and let me know if that solves your issue.
hihihih nice name, anyway yes i did try what you told me and it works, yet your right again embedding creates an issue on the file size. would you tell me what fonts do not need to be embedded?
You only need to embed the font you want to use for that particular dynamic text field. System fonts such as Arial or Times New Roman don't necessarily need to be embedded since these are common fonts. You can find a list of common fonts here