# AS2 Carousel & XML - internal URLS

**URL:** <https://forum.kirupa.com/t/as2-carousel-xml-internal-urls/297583>\
**Category:** flash\
**Created:** [October 5, 2009, 5:01pm UTC](https://forum.kirupa.com/t/as2-carousel-xml-internal-urls/297583 "2009-10-05T17:01:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Galland](https://avatars.discourse-cdn.com/v4/letter/g/edb3f5/32.png) [@Galland](https://forum.kirupa.com/u/Galland)\
**Post date:** [October 5, 2009, 5:01pm UTC](https://forum.kirupa.com/t/as2-carousel-xml-internal-urls/297583/1 "2009-10-05T17:01:39Z")

</div>

Hi

Think I’m pretty close to success here…

Using an AS2 Carousel type menu with XML powered icons - and I’m trying to use the icons to load URLs within the main movie - in other words, load SWFs into the movie as opposed to external links.

Someone here (thirdCherry) was kind enough provide this for internal loading targeting a movieClip:

[FONT=Courier New]//on release function[/FONT]  
[FONT=Courier New]function released()[/FONT]  
[FONT=Courier New]{[/FONT]  
[FONT=Courier New]getURL(this.\_parent.url);[/FONT]  
[FONT=Courier New]target\_mc.loadMovie(nodes\*.attributes.url);[/FONT]  
[FONT=Courier New]}[/FONT]

HOWEVER: my XML file looks like this:

\<icons\>  
\<icon image=“icon1.png” url=“facts1.swf” /\>  
\<icon image=“icon2.png” url=“facts2.swf” /\>  
\<icon image=“icon3.png” url=“facts3.swf” /\>  
\<icon image=“icon4.png” url=“facts4.swf” /\>  
\<icon image=“icon5.png” url=“facts5.swf”/\>  
\</icons\>

…and I’m thinking - is this still configured for an external URL? How do I adjust this to have my swf load into my target\_mc movieClip instead of in an external browser window?

Thanks VERY much for any help - I’m doing well with AS3 - not so hot with AS2 / XML yet!

Galland:block:

PS here is entire AS2 code - mostly from [xuroqflash.com](http://xuroqflash.com):

[FONT=Courier New]import mx.utils.Delegate;[/FONT]  
[FONT=Courier New]//set variables[/FONT]  
[FONT=Courier New]var numOfItems:Number;[/FONT]  
[FONT=Courier New]var radiusX:Number = 240;[/FONT]  
[FONT=Courier New]var radiusY:Number = 95;[/FONT]  
[FONT=Courier New]var centerX:Number = 550;[/FONT]  
[FONT=Courier New]var centerY:Number = 300;[/FONT]  
[FONT=Courier New]var speed:Number = 0.1;[/FONT]  
[FONT=Courier New]var perspective:Number = 150;[/FONT]  
[FONT=Courier New]var home:MovieClip = this;[/FONT]

[FONT=Courier New]//load XML shhet(images)[/FONT]  
[FONT=Courier New]var xml:XML = new XML();[/FONT]  
[FONT=Courier New]xml.ignoreWhite = true;[/FONT]

[FONT=Courier New]xml.onLoad = function()[/FONT]  
[FONT=Courier New]{[/FONT]  
[FONT=Courier New]var nodes = this.firstChild.childNodes;[/FONT]  
[FONT=Courier New]numOfItems = nodes.length;[/FONT]  
[FONT=Courier New]for(var i=0;i\<numOfItems;i++)[/FONT]  
[FONT=Courier New]{[/FONT]  
[FONT=Courier New]var t = home.attachMovie(“item”,“item”+i,i+1);[/FONT]  
[FONT=Courier New]t.angle = i \* ((Math.PI_2)/numOfItems);[/FONT]  
[FONT=Courier New]t.onEnterFrame = mover;[/FONT]  
[FONT=Courier New]t.url = nodes_.attributes.url;[/FONT]  
[FONT=Courier New]t.icon.inner.loadMovie(nodes\*.attributes.image);[/FONT]  
[FONT=Courier New]t.r.inner.loadMovie(nodes\*.attributes.image);[/FONT]  
[FONT=Courier New]t.icon.onRelease = released;[/FONT]  
[FONT=Courier New]}[/FONT]  
[FONT=Courier New]}[/FONT]  
[FONT=Courier New]//on release function[/FONT]  
[FONT=Courier New]function released()[/FONT]  
[FONT=Courier New]{[/FONT]  
[FONT=Courier New]getURL(this.\_parent.url);[/FONT]  
[FONT=Courier New]target\_mc.loadMovie(nodes\*.attributes.url);[/FONT]  
[FONT=Courier New]}[/FONT]

[FONT=Courier New]xml.load(“icons.xml”);[/FONT]

[FONT=Courier New]//tells how the carousel should interact to mouse[/FONT]  
[FONT=Courier New]function mover()[/FONT]  
[FONT=Courier New]{[/FONT]  
[FONT=Courier New]this.\_x = Math.cos(this.angle) \* radiusX + centerX;[/FONT]  
[FONT=Courier New]this.\_y = Math.sin(this.angle) \* radiusY + centerY;[/FONT]  
[FONT=Courier New]var s = (this.\_y - perspective) /(centerY+radiusY-perspective);[/FONT]  
[FONT=Courier New]this.\_xscale = this.\_yscale = s\*100;[/FONT]  
[FONT=Courier New]this.angle += this.\_parent.speed;[/FONT]  
[FONT=Courier New]this.swapDepths(Math.round(this.\_xscale) + 100);[/FONT]  
[FONT=Courier New]}[/FONT]  
[FONT=Courier New]//speed of movement[/FONT]  
[FONT=Courier New]this.onMouseMove = function()[/FONT]  
[FONT=Courier New]{[/FONT]  
[FONT=Courier New]speed = (this.\_xmouse-centerX)/4500;[/FONT]  
[FONT=Courier New]}[/FONT]
