# MX attachMovie problem

**URL:** https://forum.kirupa.com/t/mx-attachmovie-problem/28836
**Category:** flash
**Created:** [August 19, 2003, 5:14am UTC](https://forum.kirupa.com/t/mx-attachmovie-problem/28836 "2003-08-19T05:14:43Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![blah\_de\_blah](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@blah\_de\_blah](https://forum.kirupa.com/u/blah_de_blah)
#### Post date: [August 19, 2003, 5:14am UTC](https://forum.kirupa.com/t/mx-attachmovie-problem/28836/1 "2003-08-19T05:14:43Z")

</div>

ok so i have this code:

[AS]  
for (i=1; i\<=20; i++) {  
var holder = attachMovie(“box”, “box+n”, ++n)  
holder.\_x = 15\*i  
}  
[/AS]

That works fine, but the problem is i want the boxes to spread out more, so i tried:

holder.\_x = 15\*i+5

But theres no difference? i tried bigger numbers too with no luck :-\ Anyone know whats wrong? thanks!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 19, 2003, 5:21am UTC](https://forum.kirupa.com/t/mx-attachmovie-problem/28836/2 "2003-08-19T05:21:58Z")

</div>

oh…you’re naming all the boxes the same name. and in flash you can’t do that. at the end of this code, you have one box called “box+n”, literally. I think you meant this:

```auto
for (i=1; i<=20; i++) {
        var holder = attachMovie("box", "box"+n, ++n)
        holder._x = 15*i
}

```

those tiny mistakes will really get you.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 19, 2003, 5:23am UTC](https://forum.kirupa.com/t/mx-attachmovie-problem/28836/3 "2003-08-19T05:23:26Z")

</div>

[AS]for (i=1; i\<=20; i++) {  
var holder = attachMovie(“box”, “box”+n, ++n)  
holder.\_x = 15_i  
}  
[/AS]  
[AS]for (i=1; i\<=20; i++) {  
var holder = attachMovie(“box”, “box”+n, ++n)  
holder.\_x = 20_i  
}  
[/AS]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 19, 2003, 5:29am UTC](https://forum.kirupa.com/t/mx-attachmovie-problem/28836/4 "2003-08-19T05:29:55Z")

</div>

thanks ithuriel, didn’t manage to spot that, but i don’ think thats the problem :-\

Even with the new code:

[AS]  
for (i=1; i\<=20; i++) {  
var holder = attachMovie(“box”, “box”+n, ++n);  
holder.\_x = 15\*i+5;  
}  
[/AS]

…the boxes still don’t seem to spread apart :-\

I’ll attach an fla…

And to voetajoeba, why did you just change it to 20\*i?? thanks!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 19, 2003, 5:33am UTC](https://forum.kirupa.com/t/mx-attachmovie-problem/28836/5 "2003-08-19T05:33:59Z")

</div>

Because they are more spread when you set it to 20 😉 Look at the code:

[AS]  
for (i=1; i\<=20; i++) {  
var holder = attachMovie(“box”, “box”+n, ++n);  
holder.\_x = 15_i; //So 15_1, 15_2, 15_3, …  
}  
[/AS]  
[AS]  
for (i=1; i\<=20; i++) {  
var holder = attachMovie(“box”, “box”+n, ++n);  
holder.\_x = 20_i; //So 20_1, 20_2, 20_3, …  
}  
[/AS]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 19, 2003, 5:54am UTC](https://forum.kirupa.com/t/mx-attachmovie-problem/28836/6 "2003-08-19T05:54:09Z")

</div>

oh i see 😛 But doesn’t it work if you do it just like:

(15\*1)+5

anyways thanks i guess i’ll do it your way since my way doesn’t seem to be workin :-\

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 19, 2003, 6:15am UTC](https://forum.kirupa.com/t/mx-attachmovie-problem/28836/7 "2003-08-19T06:15:08Z")

</div>

I know why it doesn’t work, but I can’t really explain it. This might help:

```auto
15*1 = 15 + 5 = 20
15*2 = 30 + 5 = 35
15*3 = 45 + 5 = 50
15*4 = 60 + 5 = 65
15*5 = 75 + 5 = 80
15*6 = 90 + 5 = 95
15*7 = 105 + 5 = 110
15*8 = 120 + 5 = 125
15*9 = 135 + 5 = 140
15*10 = 150 + 5 = 155
15*11 = 165 + 5 = 170
15*12 = 180 + 5 = 185
15*13 = 195 + 5 = 200
15*14 = 210 + 5 = 215
15*15 = 225 + 5 = 230
15*16 = 240 + 5 = 245
15*17 = 255 + 5 = 260
15*18 = 270 + 5 = 275
15*19 = 285 + 5 = 290
15*20 = 300 + 5 = 305

```

See? You’re adding 5 to the value returned by 15_i.  
[AS]holder.\_x = 15_i+5\*i;[/AS]  
That would do.

Although I’d do what Voetsjoeba said, it’s simpler. 😛
