Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-18-2009, 04:20 PM   #1
Senior Member
Join Date: Jun 2006
Posts: 145
Default Xml Attributes problem.

When I try to load in my xml attributes it loads in all the attribures for that node not just the Title Or Description. How do I get it to just load the Title.

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("2152.xml"));

function loadXML(e:Event):void {

	var xml=new XML(e.target.data);


	//++++++++++++++++++ Get Questions ++++++++++++++++++++++
	var bookAttributes:XMLList=xml.question.attributes();
	for each (var txt:XML in bookAttributes) {
	//++++++++++++++++++ End ++++++++++++++++++++++++++++++++

	//+++++++++++++++ Get Object Description ++++++++++++++++
	var DesAttrubutes:XMLList=xml.attributes();
	for each (var DesXML:XML in DesAttrubutes) {
	//+++++++++++++++ END +++++++++++++++++++++++++++++++++++ 

	//+++++++++++++++ Get Object Title ++++++++++++++++++++++
	var TitleAttrubutes:XMLList=xml.attributes();
	for each (var TitleXML:XML in TitleAttrubutes) {
	//+++++++++++++++ END +++++++++++++++++++++++++++++++++++


 <questionGroup Title="Name the Presidents" Intro="In this game, you will be asked to identify the U.S. President being described.  Answer as quickly as possible to earn the most points.  "> 

<question txt="I wrote a book rejecting the divinity of Jesus." points="25"><answer1 correct="false" txt="Jimmy Carter"/><answer2 correct="true" txt="Thomas Jefferson"/><answer3 correct="false" txt="Barack Obama"/><answer4 correct="false" txt="Abraham Lincoln"/></question>

<question txt="I had to borrow money to go to my own inauguration." points="25"><answer1 correct="false" txt="Rutherford B. Hayes"/><answer2 correct="false" txt="Abraham Lincoln"/><answer3 correct="false" txt="William J. Clinton"/><answer4 correct="true" txt="George Washington"/></question>

jdsflash is offline  
Old 11-18-2009, 05:40 PM   #2
Registered User
Join Date: Mar 2009
Posts: 23

var xml=new XML(e.target.data);
trace(xml.@Title); // Name the Presidents
adamlach86 is offline  
Old 11-18-2009, 05:43 PM   #3
Senior Member
Join Date: Jun 2006
Posts: 145

Originally Posted by adamlach86 View Post
var xml=new XML(e.target.data);
trace(xml.@Title); // Name the Presidents
Thats perfect thanks!
jdsflash is offline  
Closed Thread

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 01:53 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.