# attachMovie();

**URL:** https://forum.kirupa.com/t/attachmovie/216388
**Category:** flash
**Created:** [February 16, 2007, 1:50am UTC](https://forum.kirupa.com/t/attachmovie/216388 "2007-02-16T01:50:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Nineteen](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nineteen/32/2679_2.png) [@Nineteen](https://forum.kirupa.com/u/Nineteen)
#### Post date: [February 16, 2007, 1:50am UTC](https://forum.kirupa.com/t/attachmovie/216388/1 "2007-02-16T01:50:19Z")

</div>

```auto

var playAll:Function = function () {
    //trace("Playin");
    //_root.play();
    var endCount:Number = 0;
    for (var count:Number = 0; count<=endCount; count++) {
        _root.attachMovie("FadeBox_ID", "Pic2_Mask_"+count, _root.getNextHighestDepth(), {_x:myX, _y:myY});
        _root["Pic2_Mask_"+count].cacheAsBitmap = true;
        _root["Pic2_MC_"+count].cacheAsBitmap = true;
        _root["Pic2_MC_"+count].setMask(_root["Pic2_Mask_"+count]);
        trace(["Pic2_Mask_"+count]);
        if (count <= endCount) {
            _root.Pic2_Mask_0.play();
        }
    }
};

```

Wrote this piece of AS and I don’t know whats wrong. Pic2\_Mask\_0 (Is a fading block MC with a stop() at the start and end). When I play the movie, the mask does not work - But if I hit enter in SWF Player to play it again, it displays.

I am preloading the LINK’d MC without using export b4 first frame, its in the timeline and is skipped (Senocular’s Method).

How can I get this to function?
