Results 1 to 2 of 2

Thread: XML events with blurb help

  1. #1
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default XML events with blurb help

    I got some help way back when from Medyman in regards to XML and events with an image and blurb. The AS is clean, simple and perfect for the situation. The only problem I am having right now is the menu the AS builds from the XML, builds itself, with no real variables to help it blend (i.e. fonts style, colour and positioning.

    I tried to move the MC from the library onto the stage and position it and assign font styles and it still builds in the top left corner. The AS is below, I just need help figuring out how to assign the menu to a MC so I can do all the above things mentioned.....

    Code:
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    
    // Variables
    var Images;
    var Events;
    var current:Number = 0;
    
    xml.onLoad = function(success) {
    	Images = xml.firstChild.childNodes
    	Events = xml.firstChild.childNodes
    	buildNavigation();
    }
    
    function buildNavigation() {
    	for(i=0;i<Images.length;i++) {
    		var item:MovieClip = this.attachMovie("menu_item", "menu_item_"+i, i);
    		item._y = i*24;
    		item.id = i;
    		item.title_text.text = Images[i].childNodes[0].firstChild
    		item.onRelease = function() { showImage(this.id); }
    		item.onRollOver = over;
    		item.onRollOut = out;
    	}
    }
    
    function showImage(node) {
    	image_holder.loadMovie(Images[node].childNodes[1].firstChild);
    	event_caption.text = Events[node].childNodes[2].firstChild
    }
    
    xml.load("events.xml");
    Any help would be great as I am drawing blanks.

  2. #2
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    I tried changing the code to this
    Code:
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    
    // Variables
    var Images;
    var Events;
    var Navigation;
    var current:Number = 0;
    
    xml.onLoad = function(success) {
    	Images = xml.firstChild.childNodes
    	Events = xml.firstChild.childNodes
    	Navigation = xml.firstChild.childNodes
    }
    
    function Navigation() {
    	for(i=0;i<Images.length;i++) {
    		var item:MovieClip = this.attachMovie("menu_item", "menu_item_"+i, i);
    		item._y = i*24;
    		item.id = i;
    		item.title_text.text = Images[i].childNodes[0].firstChild
    		item.onRelease = function() { showImage(this.id); }
    		item.onRollOver = over;
    		item.onRollOut = out;
    	}
    }
    
    function showImage(node) {
    	image_holder.loadMovie(Images[node].childNodes[1].firstChild);
    	event_caption.text = Events[node].childNodes[2].firstChild
    	menu_item.text = Navigation[node].childNodes[3].firstChild
    }
    
    xml.load("events.xml");
    And that's not doing the trick. Does anyone have any input on this?

Bookmarks

Posting Permissions

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