A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: XML troubles...

Threaded View

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    6

    XML troubles...

    Alright, sorry for all the problems.

    What I have been working towards is making a menu that loads using xml. Then when a button is pressed, i want to assemble a new menu and tween it in. My problem has been going to a certain location in the xml to load all of the button below a certain one.

    Code:
    <?xml version="1.0" enocoding="UTF-8"?>
    <Base>	
    	<Spacer>		
    		<MainButton Name="About Kkthxbai" Content="test.swf" >
    			<MainButton Name="test1" Content="test.swf" />
    			<MainButton Name="susubmenu" Content="test.swf" />
    		</MainButton>
    		<MainButton Name="Portfolio" Content="test.swf" />
    		<MainButton Name="Contact" Content="test.swf" />
    		<MainButton Name="Store" Content="test.swf" />
    		<MainButton Name="Inspiration" Content="test.swf" />	
    		
    	</Spacer>
    		
    </Base>
    This is my xml just for testing purposes.

    I have tried using xml[VariableHoldingXmlLocation].MainButton.length but if the variable held a string of "Spacer.MainButton[0]" it would not return 2 but instead look for a Spacer.MainButton[0] node. So if anyone has an idea on how to make it realize that periods are not part of the name please respond.

    After failing with this, I have tried to search the xml by using the name attribute but have come up empty. After looking at 2 dozen E4X tutorials, I have tried using
    Code:
    var nodelist:XMLList = xml.descendants.(attribute("Name") == "About Kkthxbai");
    trace(nodelist.length() );
    But everytime I do this I still get 0 even though there is a node with the attribute of About Kkthxbai : <MainButton Name="About Kkthxbai" Content="test.swf" >

    I have also tried var nodelist:XMLList = xml.descendants.(@Name == "About Kkthxbai");

    So any help is appreciated on a better way to do this, or a fix to my searching xml.
    Last edited by jmacnak; 06-17-2010 at 01:27 AM.

Tags for this Thread

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