# Hey I need some action script help :(

**URL:** <https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001>\
**Category:** flash\
**Created:** [April 25, 2006, 10:51pm UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001 "2006-04-25T22:51:20Z")\
**Posts on this page:** 11\
**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 25, 2006, 10:51pm UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/1 "2006-04-25T22:51:20Z")

</div>

Ok I have the following code…

```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
};

```

I want to load this dynamic menu on an empty movie clip located on the main timeline…say “emptymc”. What do I have to change in order to do that? Thanks a bunch!

---

<div class="post-metadata">

**Author:** ![codemonkeypete](https://avatars.discourse-cdn.com/v4/letter/c/b77776/32.png) [@codemonkeypete](https://forum.kirupa.com/u/codemonkeypete)\
**Post date:** [April 25, 2006, 11:21pm UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/2 "2006-04-25T23:21:50Z")

</div>

just make the menu a swf itself.  
then in your main swf file, load the menu.swf into your container clip.  
[AS]\_root.containerClip.loadMovie(“menu.swf”);[/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 25, 2006, 11:23pm UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/3 "2006-04-25T23:23:41Z")

</div>

Hm thats a good idea… thanks!

But for future reference, what if I just wanted to add it so that it creates the buttons in an empty movie clip… what would I have to change?

---

<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:25pm UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/4 "2006-04-25T23:25:49Z")

</div>

Wait no on second thought that wont work, its still being loaded on the main time line (the dynamic buttons)…

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 26, 2006, 12:37am UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/5 "2006-04-26T00:37:04Z")

</div>

naw it should be on containerclips timeline

containerclip = myEmptyMovieClip or whatever you were gonna call it

---

<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 26, 2006, 12:43am UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/6 "2006-04-26T00:43:26Z")

</div>

I thought when you load something into \_root it loads it into the MAIN timeline?

anyway, it would be nice to know how i could load those dynamic elements into its own movie clip so that I dont have to fiddle with external swfs… 🙂

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 26, 2006, 12:50am UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/7 "2006-04-26T00:50:54Z")

</div>

well you empty container clip is on the main timeline

so the command is

\_root[“MCtimeline to attach to”].attachmovie

you can do it without fiddling with external swfs its just easier for you to fiddle with external clips

alternatively you could do

root.containerClip.attachMovieClip(“linkage”,“new Instance name”,depth);  
and set the X/y of the new movie clip(but remember to use localtoGlobal and globalToLocal to convert the coords inside/outide your container clip otherwise its not going to place right

---

<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 26, 2006, 1:03am UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/8 "2006-04-26T01:03:31Z")

</div>

and what would i do about

```
	_root.["item"+i].nametxt.text = items*.attributes.name;

```

i tried \_root.emptymc[“item”+i].nametxt.text = items\*.attributes.name;

but that didnt see to work with what you wrote above…

---

<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 26, 2006, 2:05am UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/9 "2006-04-26T02:05:20Z")

</div>

ok my problem is that menu that is being loaded wont unload itself. While I CAN unload the dynamic clips by doing an unloadmovie command, its not feasable because I never know how many buttons are actually going 2 b created…

I need to b able to load those buttons in its own movie clip so that I can unload that movie clip @ will… the method u listed above actually creates the dynamic buttons on the main timeline. please help ☹

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 26, 2006, 2:26am UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/10 "2006-04-26T02:26:04Z")

</div>

I dunno im pretty new to flash post yer FLA and maybe i can help fix it…

---

<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:42am UTC](https://forum.kirupa.com/t/hey-i-need-some-action-script-help/187001/11 "2006-04-26T04:42:31Z")

</div>

> **[A lil flash/xml help!](https://www.kirupa.com/forum/showthread.php?t=216860)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

scotty(-:
