# attachMovie question

**URL:** <https://forum.kirupa.com/t/attachmovie-question/18996>\
**Category:** flash\
**Created:** [April 23, 2003, 10:33am UTC](https://forum.kirupa.com/t/attachmovie-question/18996 "2003-04-23T10:33:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tezza](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tezza/32/214_2.png) [@tezza](https://forum.kirupa.com/u/tezza)\
**Post date:** [April 23, 2003, 10:33am UTC](https://forum.kirupa.com/t/attachmovie-question/18996/1 "2003-04-23T10:33:41Z")

</div>

here’s my question:

I have 4 buttons on the stage which, when pressed, attaches one of 4 movieClips to an emptyClip on the stage. EG:  
pressing button 2 runs this script:

emptyClip.attachMovie(“movieClip2”, “movieClip2”, 0);

What I want to do is be able to trace the name of the clip that is attached to emptyClip at the time of pressing another button on the stage, like a confirmation button that traces, for example, that “movieClip2” is the final selection.

I can only get “\_name” to return the name of the emptyClip

I hope this makes sense!

---

<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:** [April 23, 2003, 11:48am UTC](https://forum.kirupa.com/t/attachmovie-question/18996/2 "2003-04-23T11:48:03Z")

</div>

if i’m not mistaken… u want to show a text is’nt it??

---

<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:** [April 23, 2003, 11:51am UTC](https://forum.kirupa.com/t/attachmovie-question/18996/3 "2003-04-23T11:51:10Z")

</div>

Hi,  
Not sure if this will give you want you want, but try it:  
[AS]trace(emptyClip.\_name-1);[/AS]

essentially if you put your trace on the button,(say button3)that code should give you the result of what the previous button did ? !!!

Let me know

SteveD

---

<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:** [April 23, 2003, 11:53am UTC](https://forum.kirupa.com/t/attachmovie-question/18996/4 "2003-04-23T11:53:24Z")

</div>

I’m not sure what u mean… What I ultimately want to do is to store the users selected movieClip name (the one attached to emptyClip) to a database when they hit the “confirm” button…

---

<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:** [April 23, 2003, 12:04pm UTC](https://forum.kirupa.com/t/attachmovie-question/18996/5 "2003-04-23T12:04:38Z")

</div>

Hi,  
Sorry I thought you was trying to trace the previously loaded clip, the code I posted will not work anyway, so back to the drawing board.  
A quick and dirty way would be to do this :  
On your main timeline declare a var, something like :  
var count =0;  
In your movie clips that are being loaded into the empty clip, put in the first frame  
[AS]\_root.count=1;[/AS]  
and so on, so that each mc increases the var by one.  
Then on the next ( or perhaps the last frame of your movie, write some if else statements like:  
[AS]if(count==1){  
save clip1;  
} else if (count==2){  
save clip2[/AS]

and so on, obviously the **save clip** bit needs to be changed to whatever code you are using when the confirm button is hit.

Cheers

SteveD

---

<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:** [April 23, 2003, 12:17pm UTC](https://forum.kirupa.com/t/attachmovie-question/18996/6 "2003-04-23T12:17:52Z")

</div>

You could simply place the following code on the first frame of each movie clip you are loading

\_root.vName=“someClipImAttaching”;

Short of that easy method… there is a more complex way using a “for in” loop to get it. If you don’t like the first suggestion let me know and I’ll describe the “for in” method.

---

<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:** [April 23, 2003, 12:19pm UTC](https://forum.kirupa.com/t/attachmovie-question/18996/7 "2003-04-23T12:19:31Z")

</div>

Thanks SteveD & David,

The SteveD idea works great. It’s for a prototype of a site, so quick and dirty is good enough for now.

Cheers & thanks for the quick response.

---

<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:** [April 23, 2003, 12:32pm UTC](https://forum.kirupa.com/t/attachmovie-question/18996/8 "2003-04-23T12:32:25Z")

</div>

Hi Tezza,  
Glad it helped, Davids method is identical, he’s just using a string instead of a numeric, but essentially it would work the same.  
Also, he’s right, a for…loop would probably be more efficient, but if you only have four clips to worry about it doesn’t make a lot of difference

Cheers

SteveD

---

<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:** [April 23, 2003, 2:01pm UTC](https://forum.kirupa.com/t/attachmovie-question/18996/9 "2003-04-23T14:01:44Z")

</div>

Yep, I see what you mean, I’ll keep David’s method in mind if it gets a little complex…

Cheers

Terry
