Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 1 of 1

Thread: XML Loader

  1. #1

    XML Loader

    Hi. I want to create a flash movie that uses XML to load some data. I want each line of data to appear one by one when a user clicks on the screen. So far I have all my data added to the screen but I'm not sure how to write the clicking mechanism for this.

    I've managed to remove an object by clicking on it, but I don't know how get that object back. Ideally I'd like each object to be shown one item at a time.

    My Document Class Follows

    Code:
    package  {
    	
    	import flash.display.MovieClip;
    	import flash.text.TextField;
        import flash.events.MouseEvent; 
    	
    	public class MuppetsDoc extends MovieClip {
    		
    		public var myData:XML = <data>
    			<item>
    				<a>Kermit the Frog</a>
    				<b>Jim Henson</b>
    				<c>1955</c>
    			</item>
    			<item>
    				<a>Miss Piggy</a>
    				<b>Frank Oz</b>
    				<c>1974</c>
    			</item>
    			<item>
    				<a>Animal</a>
    				<b>Frank Oz</b>
    				<c>1975</c>
    			</item>
    			
    			<item>
    				<a>The Swedish Chef</a>
    				<b>Jim Henson/Frank Oz</b>
    				<c>1975</c>
    			</item>
    
    
    		</data>;
    
    
    		
    		
    		public function MuppetsDoc() {
    			
    			
    			// constructor code
    			//trace(myData);
    			//muppets_txt.text = myData.item[2].a.length();
    			var aTxt:String = myData.item[2].a.text();
    			muppet_name0.appendText(myData.item[0].a.text());
    			
    			muppet_puppet0.appendText(myData.item[0].b.text());
    
    
    			muppet_year0.appendText(myData.item[0].c.text());
    
    muppet_name0.addEventListener(MouseEvent.CLICK, fl_ClickToKermit);
    
    
    function fl_ClickToKermit(event:MouseEvent):void
    {
    	muppet_name0.visible = false;
    
    
       if (muppet_name0.visible == false) {
            //if it is make them invisible
            muppet_name0.visible = false;
        } else {
            //otherwise make them visible
            muppet_name0.visible = true;
        }
    }
    
    }
    	}
    	
    }
    Last edited by jbsosbj; April 12th, 2012 at 10:29 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012