# Attachmovie (and path) trouble

**URL:** https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904
**Category:** Uncategorized
**Created:** [March 12, 2002, 10:26pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904 "2002-03-12T22:26:26Z")
**Posts on this page:** 14
**Page:** 1

<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: [March 12, 2002, 10:26pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/1 "2002-03-12T22:26:26Z")

</div>

I have that code in an empty movie clip :

```auto
  onClipEvent (load) {\r\rx = new Array ;\r\ry = new Array ;\r\rz = new Array ;\r\rx = [50,100,100,50] ;\r\ry = [50,50,100,100] ;\r\rz = [50,50,100,100] ;\r\r\r\rfor(i = 1;i<5;i++) {\r\r attachMovie("viewer", "t"+i, i);\r\r var mc = this["t"+i];\r\r mc._x = x[i-1];\r\r mc._y = y[i-1];\r\r mc.z = z[i-1] ;\r\r }\r\r}

```

In the movie I attach :

```auto
  onClipEvent (enterFrame) {\r\rpers = (z+_root.d)/_root.d ;\r\r}

```

The problem is that z doesn’t get to the clips I’m attaching. I thought that doing mc.z would be enough to use z in the attached movie, but it doesn’t seem to work (trace (z) returns nothing).\r\rThanks.\r\rpom 0]

---

<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: [March 12, 2002, 10:34pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/2 "2002-03-12T22:34:50Z")

</div>

x = new Array ;\ry = new Array ;\rz = new Array ;\rx = [50,100,100,50] ;\ry = [50,50,100,100] ;\rz = [50,50,100,100] ;\r I am Not Supra (joke joke, jubba…), but it looks to me as if you have a reset of z to a new array on every load event of your empty clip?!\r\rWhy not just:\rx = [50,100,100,50] ;\ry = [50,50,100,100] ;\rz = [50,50,100,100] ;\r(no need for that extra declaration…)?\r\rva dormir!..

---

<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: [March 12, 2002, 10:48pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/3 "2002-03-12T22:48:44Z")

</div>

Hey, you’re the one who needs to go to sleep ! I don’t reset z on load, at least I don’t think I am, since the clip containing the first bit of code only loads at the beginning of the movie. (suppressing the declaration doesn’t do anything)\r\rYou’re right though, I should go to sleep ☹ \r\rpom 0]

---

<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: [March 12, 2002, 10:52pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/4 "2002-03-12T22:52:37Z")

</div>

Told you I’m not supra…good night!\rA demain. Va te moquer un peu de notre ami dans le Random/Question post 😉

---

<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: [March 12, 2002, 11:14pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/5 "2002-03-12T23:14:17Z")

</div>

ok, a little code clean-up tip for you:\ryou don’t have to declare a new array like this:\raHello = new Array();\rwhen you do this:\raHello = [];\ror this:\raHello = [“this”,“initializes”,“an”,“array”];\rthe array is initialized.\ryou can save a lot of lines by just initializing an array with the square brackets!!\r:) \rjeremy

---

<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: [March 13, 2002, 12:13am UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/6 "2002-03-13T00:13:16Z")

</div>

Still it doesn’t work…\rpom 0]

---

<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: [March 13, 2002, 1:57am UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/7 "2002-03-13T01:57:03Z")

</div>

ily,\r\ronClipEvent() events don’t get passed when you attach. however, onClipEvents on a movie _inside_ an attached movie do.\r\ra good workaround is to put an empty clip in “viewer” that contains the onClipEvent events pathed to \_parent. ie:

```auto
 \r\ronClipEvent (enterFrame) {\r\r _parent.pers = (_parent.z+_root.d)/_root.d ;\r\r}

```

\rotherwise everything looks good. the z’s were passed just fine when i cut and paste your code. perhaps there was an error in the trace action?\r\rcheers.

---

<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: [March 13, 2002, 7:22am UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/8 "2002-03-13T07:22:16Z")

</div>

\<\<onClipEvent() events don’t get passed when you attach. however, onClipEvents on a movie _inside_ an attached movie do\>\>\r\rHow do you find out stuff like this, trial and error, or is that stated s’where?\rGood to know anyway!

---

<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: [March 13, 2002, 10:58am UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/9 "2002-03-13T10:58:16Z")

</div>

You need a bunch of books… Flash 5.0 Developer’s Guide has a really good run through from a medium flasher level’s perspective. Flash Action script Game design does a really good number on movie clips as well.

---

<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: [March 13, 2002, 6:26pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/10 "2002-03-13T18:26:29Z")

</div>

anything on a movie is instance specific. thus one button can be used over and over. it’s a feature, but it can catch you if you don’t watch for it.\r\rthe exception to this rule is with duplicateMovieClip(). then the onClipEvents carry over. incidentally, movies which have been attached to a clip are not duplicated. i guess they fall into the same catagory as variables and properties, which are also not duplicated.\r\ri would recommend a good internet connection over a book any day. i don’t own any flash books. although i must admit, i’ve been sorely tempted to buy moock’s book. i understand brandon hall is writing a book geared towards flash mx and oop. i’ll be sorely tempted to buy that book as well.\r

---

<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: [March 13, 2002, 8:47pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/11 "2002-03-13T20:47:37Z")

</div>

which one should i buy, i figure since im just starting out amybe i should buy a book since ive done all of the tutoials that i can find but im still dont understand that much…

---

<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: [March 13, 2002, 10:07pm UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/12 "2002-03-13T22:07:05Z")

</div>

What does that mean,

> onClipEvent() events don’t get passed when you attach  
> I’m not sure I understand. But your advice took me back on the right tracks. Thanks !!\r\rpom 0]

---

<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: [March 14, 2002, 12:48am UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/13 "2002-03-14T00:48:51Z")

</div>

What Supra means is that actions which are associated to the outside of a movie clip, are not in the library, so by using the “attach” feature, drawing a movie clip into the swf from the library, there is no action script associated with it. If you were to take a movie clip, associate a/s with it, and then place that inside ANOTHER movie clip, then when you attached the container clip, the movieclip inside it would have the a/s associated with it.\r\rhmm… that sounds really confusing.

---

<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: [March 14, 2002, 12:52am UTC](https://forum.kirupa.com/t/attachmovie-and-path-trouble/2904/14 "2002-03-14T00:52:09Z")

</div>

Oh I see… It’s actually very clear. Thanks Upu. \rNevertheless, the trouble came from a wrong path ☹ \rpom 0]
