# \_root.createEmptyMovieClip = little problem

**URL:** <https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127>\
**Category:** Uncategorized\
**Created:** [August 2, 2004, 11:41pm UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127 "2004-08-02T23:41:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Odissey\_NYC](https://avatars.discourse-cdn.com/v4/letter/o/9d8465/32.png) [@Odissey\_NYC](https://forum.kirupa.com/u/Odissey_NYC)\
**Post date:** [August 2, 2004, 11:41pm UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127/1 "2004-08-02T23:41:28Z")

</div>

Hello All,

I’m using this little script to open an external jpg file it’s for a photo gallery:

on (release) {  
\_root.createEmptyMovieClip(“holder”,1);  
holder.loadMovie("…/pic/photo1.jpg");  
holder.\_x= 200, holder.\_y = 150 ;  
}

That’s working fine… :o)

the only propblem, is that I cannot close it !  
the picture stays on top of the all movie…

:o/

any hint ?

Thanks!  
JP

---

<div class="post-metadata">

**Author:** ![eyezberg](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@eyezberg](https://forum.kirupa.com/u/eyezberg)\
**Post date:** [August 3, 2004, 5:58am UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127/2 "2004-08-03T05:58:08Z")

</div>

this  
holder.\_x= 200, holder.\_y = 150 ;  
should be  
holder.\_x= 200;  
holder.\_y = 150 ;

what do you mean by “close it”?  
of course it stays on top, as you create the empty clip at a depth of 1 in \_root…

---

<div class="post-metadata">

**Author:** ![Odissey\_NYC](https://avatars.discourse-cdn.com/v4/letter/o/9d8465/32.png) [@Odissey\_NYC](https://forum.kirupa.com/u/Odissey_NYC)\
**Post date:** [August 3, 2004, 1:27pm UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127/3 "2004-08-03T13:27:58Z")

</div>

> [@eyezberg](#):
>
> this  
> holder.\_x= 200, holder.\_y = 150 ;  
> should be  
> holder.\_x= 200;  
> holder.\_y = 150 ;
> 
> what do you mean by “close it”?  
> of course it stays on top, as you create the empty clip at a depth of 1 in \_root…

Thanks for the correction Eyezberg, I get the concept of levels, and it’s fine that this picture stays on top, it’s when I don’t want the picture anymore on the screen, I don’t know hoe to unload it, I tried a bunch of different things (logical for me but not really for Flash!) I thought for exampl IF:

holder.loadMovie(“…/pic/photo1.jpg”); loads the jpg in the MC container,

holder.UNloadMovie(“…/pic/photo1.jpg”); would unload it…

Well, It didn’t …  
Where I am mistaken… ?  
Thanks guys,

---

<div class="post-metadata">

**Author:** ![newhopekenny](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/newhopekenny/32/317_2.png) [@newhopekenny](https://forum.kirupa.com/u/newhopekenny)\
**Post date:** [August 3, 2004, 2:48pm UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127/4 "2004-08-03T14:48:41Z")

</div>

Well you could try unloadMovie(“yourMC”); instead of UNloadMovie(“yourMC”); … 😉

---

<div class="post-metadata">

**Author:** ![Odissey\_NYC](https://avatars.discourse-cdn.com/v4/letter/o/9d8465/32.png) [@Odissey\_NYC](https://forum.kirupa.com/u/Odissey_NYC)\
**Post date:** [August 3, 2004, 3:48pm UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127/5 "2004-08-03T15:48:27Z")

</div>

> [@newhopekenny](#):
>
> Well you could try unloadMovie(“yourMC”); instead of UNloadMovie(“yourMC”); … 😉

Thanks, newhopekenny!, that’s working BUT now this action remove all the movies! … the one on level 0 as well (menu etc…)

The action for the “return to menu” button is:  
[color=blue]on (release) {  
\_root.unloadMovie(“holder”,1);  
this.\_parent.gotoAndPlay(‘main-menu’);  
}[/color]  
[color=black]That is the code on another button that create the MC-holder and load the jpg:[/color]  
[color=blue]on (release) {  
\_root.createEmptyMovieClip(“holder”,1);  
holder.loadMovie(“…/pic/photo1.jpg”);  
holder.\_x= 200;  
holder.\_y = 150 ;  
}[/color]  
[color=black]Any idea…? I think we are verrrry close![/color]  
[color=black]Thanks ![/color]

---

<div class="post-metadata">

**Author:** ![eyezberg](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@eyezberg](https://forum.kirupa.com/u/eyezberg)\
**Post date:** [August 3, 2004, 5:48pm UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127/6 "2004-08-03T17:48:53Z")

</div>

Do you HAVE TO unload?  
Can’t you just move it off screen by resetting it’s \_x or \_y value, or setting it’s \_visible to false?

---

<div class="post-metadata">

**Author:** ![JakeO](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JakeO](https://forum.kirupa.com/u/JakeO)\
**Post date:** [August 3, 2004, 5:52pm UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127/7 "2004-08-03T17:52:52Z")

</div>

> [@Odissey-NYC](#):
>
> Thanks, newhopekenny!, that’s working BUT now this action remove all the movies! … the one on level 0 as well (menu etc…)
> 
> The action for the “return to menu” button is:  
> [color=blue]on (release) {  
> \_root.unloadMovie(“holder”,1);  
> this.\_parent.gotoAndPlay(‘main-menu’);  
> }[/color]  
> [color=black]That is the code on another button that create the MC-holder and load the jpg:[/color]  
> [color=blue]on (release) {  
> \_root.createEmptyMovieClip(“holder”,1);  
> holder.loadMovie(“…/pic/photo1.jpg”);  
> holder.\_x= 200;  
> holder.\_y = 150 ;  
> }[/color]  
> [color=black]Any idea…? I think we are verrrry close![/color]  
> [color=black]Thanks ![/color]

bad code, dont do \_root.unloadMovie(blah)…do this  
\_root.holder.unloadMovie()

-Jake

---

<div class="post-metadata">

**Author:** ![Odissey\_NYC](https://avatars.discourse-cdn.com/v4/letter/o/9d8465/32.png) [@Odissey\_NYC](https://forum.kirupa.com/u/Odissey_NYC)\
**Post date:** [August 3, 2004, 6:11pm UTC](https://forum.kirupa.com/t/-root-createemptymovieclip-little-problem/118127/8 "2004-08-03T18:11:01Z")

</div>

> [@JakeO](#):
>
> bad code, dont do \_root.unloadMovie(blah)…do this  
> \_root.holder.unloadMovie()
> 
> -Jake

Thanks to all of your guys, and to Jack!

Now it’s working !

Best to All !
