The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


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