# A lil flash/xml help!

**URL:** <https://forum.kirupa.com/t/a-lil-flash-xml-help/186531>\
**Category:** flash\
**Created:** [April 22, 2006, 12:53am UTC](https://forum.kirupa.com/t/a-lil-flash-xml-help/186531 "2006-04-22T00:53:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![datballa](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@datballa](https://forum.kirupa.com/u/datballa)\
**Post date:** [April 22, 2006, 12:53am UTC](https://forum.kirupa.com/t/a-lil-flash-xml-help/186531/1 "2006-04-22T00:53:17Z")

</div>

Hey, im editing a template for a friend

[http://www.goingoutnyc.com/test/](http://www.goingoutnyc.com/test/)

The events section is pulling information from an xml file…

```auto
<?xml version="1.0" ?>
<events year="2006">
<events name="Crazy Some **** Tuesdays" date="4/5/06" club="X.Bar" />
<events name="Caliente Thursdays" date="4/12/06" club="Tunnel" />
<events name="Some Listening Party" date="4/22/06" club="Club Black" />
</events>

```

What I want to do is some how link each event to an external JPEG that loads in a new browser window… so ill probably have to add some sort of flyer=“url” value to the tag, but im not sure how to go about implementing it in flash… please help i need to have this done by monday ☹ thanks in advance :hitman: :glasses: :cool: 👽 :thumb2:

---

<div class="post-metadata">

**Author:** ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)\
**Post date:** [April 22, 2006, 4:34am UTC](https://forum.kirupa.com/t/a-lil-flash-xml-help/186531/2 "2006-04-22T04:34:12Z")

</div>

COuld be as simple as adding

```auto

<events name="Crazy Some **** Tuesdays" date="4/5/06" club="X.Bar" url="your.jpg"/>

```

But that does you or us no good, because we have no idea how the fla is set up 😉

---

<div class="post-metadata">

**Author:** ![datballa](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@datballa](https://forum.kirupa.com/u/datballa)\
**Post date:** [April 22, 2006, 12:34pm UTC](https://forum.kirupa.com/t/a-lil-flash-xml-help/186531/3 "2006-04-22T12:34:36Z")

</div>

> PopulateLists = function(xml\_array){  
> name\_txt.htmlText = date\_txt.htmlText = club\_txt.htmlText = “”;  
> for (var i=0; i\<xml\_array.length; i++){  
> var student = xml\_array\*.attributes;  
> name\_txt.text += student.name + "  
> ";  
> date\_txt.text += student.date + "  
> ";  
> club\_txt.text += student.club + "  
> ";  
> }  
> }  
> name\_txt.html = true;  
> date\_txt.html = true;  
> club\_txt.html = true;  
> var students\_array;  
> var grades\_xml = new XML();  
> grades\_xml.ignoreWhite = true;  
> grades\_xml.html = true;  
> grades\_xml.onLoad = function(success){  
> if (success){  
> var grades = this.firstChild;  
> students\_array = grades.childNodes;  
> PopulateLists(students\_array);  
> }else trace(“Error loading XML file.”);  
> }  
> grades\_xml.load(“events.xml”);

Sorry 🙂 thats the as…

---

<div class="post-metadata">

**Author:** ![datballa](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@datballa](https://forum.kirupa.com/u/datballa)\
**Post date:** [April 22, 2006, 11:21pm UTC](https://forum.kirupa.com/t/a-lil-flash-xml-help/186531/4 "2006-04-22T23:21:32Z")

</div>

anybody? :ub:

---

<div class="post-metadata">

**Author:** ![datballa](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@datballa](https://forum.kirupa.com/u/datballa)\
**Post date:** [April 25, 2006, 11:04pm UTC](https://forum.kirupa.com/t/a-lil-flash-xml-help/186531/5 "2006-04-25T23:04:05Z")

</div>

Hey! I ended up figuring it out…

```auto
menu = new XML();
menu.ignoreWhite = true;
menu.load("events.xml");
menu.onLoad = function() {
	items = this.firstChild.childNodes;
	for (i=0; i&lt;=items.length-1; i++) {
		_root.attachMovie("eventbuttons", "item"+i, i);
		_root["item"+i].nametxt.text = items*.attributes.name;
		_root["item"+i].datetxt.text = items*.attributes.date;
		_root["item"+i].clubtxt.text = items*.attributes.club;
		_root["item"+i].categorytxt.text = items*.attributes.category;
		_root["item"+i]._y = 25*i;
		_root["item"+i]._y += 245.5;
		_root["item"+i]._x = 515.5;
		_root["item"+i].itemUrl = items*.attributes.theurl;
		_root["item"+i].onRelease = function() {
			getURL(this.itemUrl, "_blank");
		};
	}
	// end of for
};
```

---

<div class="post-metadata">

**Author:** ![datballa](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@datballa](https://forum.kirupa.com/u/datballa)\
**Post date:** [April 25, 2006, 11:05pm UTC](https://forum.kirupa.com/t/a-lil-flash-xml-help/186531/6 "2006-04-25T23:05:20Z")

</div>

Hey! I ended up figuring it out…

```auto
menu = new XML();
menu.ignoreWhite = true;
menu.load("events.xml");
menu.onLoad = function() {
	items = this.firstChild.childNodes;
	for (i=0; i<=items.length-1; i++) {
		_root.attachMovie("eventbuttons", "item"+i, i);
		_root["item"+i].nametxt.text = items*.attributes.name;
		_root["item"+i].datetxt.text = items*.attributes.date;
		_root["item"+i].clubtxt.text = items*.attributes.club;
		_root["item"+i].categorytxt.text = items*.attributes.category;
		_root["item"+i]._y = 25*i;
		_root["item"+i]._y += 245.5;
		_root["item"+i]._x = 515.5;
		_root["item"+i].itemUrl = items*.attributes.theurl;
		_root["item"+i].onRelease = function() {
			getURL(this.itemUrl, "_blank");
		};
	}
	// end of for
};

```

Small problem though… how do I get that code to load the menu into an empty movie clip, called…lets say “empty\_mc” instead of right on the main timeline?

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [April 26, 2006, 4:41am UTC](https://forum.kirupa.com/t/a-lil-flash-xml-help/186531/7 "2006-04-26T04:41:00Z")

</div>

```auto
menu = new XML();
menu.ignoreWhite = true;
menu.load("events.xml");
menu.onLoad = function() {
	items = this.firstChild.childNodes;
	for (i=0; i<=items.length-1; i++) {
		var empty_mc = _root.createEmptyMovieClip("empty_mc", 1);
		//position empty_mc
		empty_mc._x = empty_mc._y=50;
		var item = empty_mc.attachMovie("eventbuttons", "item"+i, i);
		item.nametxt.text = items*.attributes.name;
		item.datetxt.text = items*.attributes.date;
		item.clubtxt.text = items*.attributes.club;
		item.categorytxt.text = items*.attributes.category;
		item._y = 245.5+25*i;
		item._x = 515.5;
		item.itemUrl = items*.attributes.theurl;
		item.onRelease = function() {
			getURL(this.itemUrl, "_blank");
		};
	}
};

```

scotty(-:
