# Carousel Issues

**URL:** <https://forum.kirupa.com/t/carousel-issues/263307>\
**Category:** flash\
**Created:** [June 14, 2008, 9:10am UTC](https://forum.kirupa.com/t/carousel-issues/263307 "2008-06-14T09:10:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stupidsaint](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@stupidsaint](https://forum.kirupa.com/u/stupidsaint)\
**Post date:** [June 14, 2008, 9:10am UTC](https://forum.kirupa.com/t/carousel-issues/263307/1 "2008-06-14T09:10:27Z")

</div>

I have a carousel that uses this code:

```auto

for(var i=1;i<(numOfItems + 1);i++)
    {
        var t = home.attachMovie("item","item"+i,i+1);
        t.angle = i * ((Math.PI*2)/numOfItems);
        t.icon.onPress = function (){
            //pressed state
    }
}

```

Here is the problem:

when you press on an icon i need to get the \* to make a url name. say:

```auto

t.icon.onPress = function(){
getURL("http://www.webadress.com/" + *, "_self");
}

```

when ever i use something like this it will pull the last \* value it was using and not the one related to the one you press…

any suggestions?  
Thanks  
Stupid Saint

---

<div class="post-metadata">

**Author:** ![rumblesushi](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rumblesushi](https://forum.kirupa.com/u/rumblesushi)\
**Post date:** [June 14, 2008, 10:30am UTC](https://forum.kirupa.com/t/carousel-issues/263307/2 "2008-06-14T10:30:23Z")

</div>

t.i = i;

getURL(“[http://www.webadress.com/](http://www.webadress.com/)” + [this.i], “\_self”);

Very simple, works a treat 🙂

---

<div class="post-metadata">

**Author:** ![stupidsaint](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@stupidsaint](https://forum.kirupa.com/u/stupidsaint)\
**Post date:** [June 14, 2008, 1:12pm UTC](https://forum.kirupa.com/t/carousel-issues/263307/3 "2008-06-14T13:12:44Z")

</div>

[quote=rumblesushi;2342631]t.i = i;

getURL(“[http://www.webadress.com/](http://www.webadress.com/)” + [this.i], “\_self”);

Very simple, works a treat :)[/quote]

well… i tried this before submitting the thread and it doesn’t work. i have however found the answer and that is to change a line of code to this…

```auto
var t = home.attachMovie("item",i,i+1);

```

this makes the name of the image the number (or in this case \*)

then i used…

```auto

getURL("http://www.webadress.com/" + this._parent._name, "_self");

```

thanks for your help anyways

Stupid Saint:sen:

---

<div class="post-metadata">

**Author:** ![rumblesushi](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rumblesushi](https://forum.kirupa.com/u/rumblesushi)\
**Post date:** [June 14, 2008, 4:25pm UTC](https://forum.kirupa.com/t/carousel-issues/263307/4 "2008-06-14T16:25:15Z")

</div>

That’s weird saint, because what I said above is exactly what I do when assigning clicks in a loop, I’ve done it quite a lot, and it works perfectly for me 🙂

Glad you figured it out anyway.

Oh, the only reason it may not have worked is the “t” and the “t.icon” issue.

If you assign the rollover to icon, then you’d have to put… “t.icon.i = i”

Otherwise on press, it looks for the var “i” in icon, when it’s actually in “t”.
