# AttachMovie instead loadMovie

**URL:** https://forum.kirupa.com/t/attachmovie-instead-loadmovie/213633
**Category:** flash
**Created:** [January 21, 2007, 9:24pm UTC](https://forum.kirupa.com/t/attachmovie-instead-loadmovie/213633 "2007-01-21T21:24:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michey](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@michey](https://forum.kirupa.com/u/michey)
#### Post date: [January 21, 2007, 9:24pm UTC](https://forum.kirupa.com/t/attachmovie-instead-loadmovie/213633/1 "2007-01-21T21:24:06Z")

</div>

Hi

I would like to change a working Script, switching from loadMovie to attachMovie.  
Currently pictures are loaded as external files. I would like to keep the Transitions of the Gallery as they are, but having pictures loaded from library.  
Is that possible?  
What should be changed then?

```php
import mx.transitions.*; 
var picArray:Array = new Array("pic1.jpg", "pic2.jpg", "pic3.jpg", "pic4.jpg"); 
function setUpButtons():Void { 
    for (var i = 0; i<picArray.length; i++) { 
        var tempMC:MovieClip = this["BTN"+i]; 
        tempMC.pic = picArray*; 
        tempMC.onRelease = function() { 
            transOut(this.pic); 
            this.nextFrame(); 
        }; 
    } 
} 
function loadPic(pic:String):Void { 
    loader_mc.loadMovie(pic); 
    counter_mc = createEmptyMovieClip("c", getNextHighestDepth()); 
    counter_mc.onEnterFrame = function() { 
        if (this._parent.loader_mc.getBytesLoaded() == this._parent.loader_mc.getBytesTotal()) { 
            delete this.onEnterFrame; 
            this._parent.loader_mc._visible = false; 
            transIn(); 
        } 
    }; 
} 
function transIn():Void { 
    var myTM:TransitionManager = new TransitionManager(loader_mc); 
    myTM.startTransition({type:Iris, direction:0, duration:1, shape:"CIRCLE", startPoint:2, xSections:30, ySections:20, dimension:0, easing:easing.Strong.easeOut, shape:"CIRCLE"}); 
} 
function transOut(pic:String):Void { 
    if (loader_mc.getBytesTotal()>20) { 
        var myListener:Object = new Object(); 
        myListener.allTransitionsOutDone = function() { 
            loadPic(pic); 
        }; 
        var myTM:TransitionManager = new TransitionManager(loader_mc); 
        myTM.addEventListener("allTransitionsOutDone", myListener); 
        myTM.startTransition({type:Iris, direction:1, duration:1, shape:"CIRCLE", startPoint:2, xSections:30, ySections:20, dimension:0, easing:easing.Strong.easeOut, shape:"CIRCLE"}); 
    } else { 
        loadPic(pic); 
    } 
} 
setUpButtons();  

```

Thanks for help.
