Results 1 to 13 of 13

Thread: [RESOLVED] xml in html (php)

Threaded View

  1. #1

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Resolved [RESOLVED] xml in html (php)

    Hi,

    I have used xml in flash and figured out how accessing the button names work. This is the code I used:

    Quote Originally Posted by Nightwalker83 View Post
    I figured out the solution!

    Code:
    var req: URLRequest = new URLRequest("menuDef.xml");
    var loader:URLLoader = new URLLoader(req);
    var i:int
    var myXML:XML = new XML();
    loader.load(req);
    
    
    loader.addEventListener(Event.COMPLETE,dataLoaded);
    //Button code
    function dataLoaded (event: Event){
    	myXML = new XML(loader.data);
    	for (i = 0; i < 5; i++){
    		var j:int = i+ 1; 
    		/**3 is the line in the  
    		xml the labels start from. (i) starts counting from the 4th line until the end
            specified above.**/		
    		this["btnMenu"+ j].btText.text = myXML.child(3).child(i);
    	}      
    }
    If the items in your xml file are more or less than "5" change the number to suit.
    Now! My question is how would I access the xml data via html code and use it to display the button name flash or html?

    At the moment I am using this code within each flash button:

    Code:
    var req: URLRequest = new URLRequest("../xml/menuDef.xml"); //Remove the "/" before the folder name for the splash page.
    var loader:URLLoader = new URLLoader(req);
    var i:int
    var myXML:XML = new XML();
    this.addEventListener(MouseEvent.CLICK,callurl);
    
    loader.load(req);
    
    loader.addEventListener(Event.COMPLETE,dataLoaded);
    //Button code
    function dataLoaded (event: Event){
    	myXML = new XML(loader.data);
    	for (i = 0; i < 1; i++){
    		var j:int = i+ 1; 
    		/**3 is the line in the  
    		xml the labels start from. (i) starts counting from the 4th line until the end
            specified above.**/		
    		this["btn"+ j].btText.text = myXML.child(3).child(i);
    	}
    }
    However, I doubt that is wise pragmatically since I repeat the code in every button. In flash I could just put all the button code such as above in the main page that would be it. Is this possible to via html?

    Thanks,


    Nightwalker
    Last edited by Nightwalker83; Nov 7th, 2009 at 06:27 PM. Reason: Adding more
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

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