A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Reading XML and displaying value

  1. #1
    Member
    Join Date
    Apr 2011
    Posts
    42

    Reading XML and displaying value

    Hey Guys,

    I'm creating a interactive 'thing' where I've got buttons which when clicked show a an image and display text relating to the value in the XML file.

    The XML is working and I can trace the any percentage(value I'm looking to find).

    Code:
    function LoadXML(e:Event):void 
    {
    	
    	xmlData = new XML(e.target.data);
    	
    	DrinkList(xmlData);
    	
    }
    
    function DrinkList(DrinkInput:XML):void 
    {
    	trace("XML Output");
    	
    	trace("------------------------");
    	
    	//trace(DrinkInput.Vodka[0].Pecentage)
    
    }
    The code below is what I'm using to display the text taken from the XML file.

    Code:
    ValueTextField.x = 400; //Positions text.
    	ValueTextField.y = 200;
    	ValueTextField.autoSize = TextFieldAutoSize.LEFT;  //This is here so that the text box doesn't cause half or more of the text not to be seen.
    	ValueTextField.defaultTextFormat = MyTextFormat; //Sets the text to be formatted to the chosen format.
    	ValueTextField.text = DrinkInput.Vodka[0].Percentage;
    	addChild(ValueTextField); //Adds text to  scene.
    The error: Access of undefined property DrinkInput;

  2. #2
    Member
    Join Date
    Apr 2011
    Posts
    42
    Sorry EDIT: The second piece of code is inside the following function.

    function ShowAbsolutVodka(event:MouseEvent):void
    {

    This could be why it can't access DrinkInput?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center