# Mask a dynamically loaded image?

**URL:** <https://forum.kirupa.com/t/mask-a-dynamically-loaded-image/290689>\
**Category:** flash\
**Created:** [June 18, 2009, 11:31am UTC](https://forum.kirupa.com/t/mask-a-dynamically-loaded-image/290689 "2009-06-18T11:31:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mentha](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@mentha](https://forum.kirupa.com/u/mentha)\
**Post date:** [June 18, 2009, 11:31am UTC](https://forum.kirupa.com/t/mask-a-dynamically-loaded-image/290689/1 "2009-06-18T11:31:30Z")

</div>

I’m back and having trouble masking a dynamically loaded image. For some reason I see both the mask and the image… Any ideas are greatly appreciated, as I have to finish this project real soon…

Here’s my code:

```auto
_root.createEmptyMovieClip("container", _root.getNextHighestDepth());
container.loadMovie("myImage.jpg");

_root.createEmptyMovieClip("square_mc", _root.getNextHighestDepth());
square_mc.beginFill(0xFF0000);
square_mc.moveTo(10, 7);
square_mc.lineTo(100, 7);
square_mc.lineTo(100, 100);
square_mc.lineTo(10, 100);
square_mc.lineTo(10, 7);
square_mc.endFill();

container.setMask(square);

```

I’m at a loss here…
