# Scripting mc's called from Library

**URL:** <https://forum.kirupa.com/t/scripting-mcs-called-from-library/243828>\
**Category:** flash\
**Created:** [November 11, 2007, 2:37pm UTC](https://forum.kirupa.com/t/scripting-mcs-called-from-library/243828 "2007-11-11T14:37:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![monkeyhead](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@monkeyhead](https://forum.kirupa.com/u/monkeyhead)\
**Post date:** [November 11, 2007, 2:37pm UTC](https://forum.kirupa.com/t/scripting-mcs-called-from-library/243828/1 "2007-11-11T14:37:07Z")

</div>

Morning,

I’m working on a script that calls MovieClips from the library, and transitions them using the Tween class.  
[www.misschristine.net/new](http://www.misschristine.net/new)

ok, i have 2 functions here:

function rollClip(target)  
and  
function slideClip(target)

…The “slideClip” is an Action i want to apply to a MC the is being loaded externally (i.e. “packages\_mc”)

but…i can’t get it to work.

(the main navigation and main page functions work fine. it fails when i try to apply actions to what’s being loaded inside “container.holder”… all the sub page functions.

here’s my script:  
**[COLOR=“DeepSkyBlue”][SOURCE](http://www.misschristine.net/new/index.fla)[/COLOR]**  
///////////////////////////////////////////////////////////Actions  
import mx.transitions.Tween;  
import mx.transitions.easing.\*;

/////////////////////////////////////////////////////////// **Main page funtions**  
function rollClip(target) {  
var goAway\_tween:Object = new Tween(\_root.container.holder, “\_xscale”, Back.easeIn, 180, 0, 1, true);  
var goAway\_tween:Object = new Tween(\_root.container.holder, “\_yscale”, Back.easeIn, 180, 0, 1, true);  
var goAway\_tween:Object = new Tween(\_root.container.holder, “\_alpha”, Strong.easeIn, 100, 0, 1, true);  
trace(container.holder.\_alpha);  
goAway\_tween.onMotionFinished = function() {

```
	_root.container.holder.attachMovie(target, "target", _root.getNextHighestDepth());
	var fadeIn_tween:Object = new Tween(_root.container.holder, "_xscale", Elastic.easeOut, 0, 180, 1, true);
	var fadeIn_tween:Object = new Tween(_root.container.holder, "_yscale", Elastic.easeOut, 0, 180, 1, true);
	var fadeIn_tween:Object = new Tween(_root.container.holder, "_alpha", Elastic.easeOut, 80, 100, 1, true);
	trace(container.holder._alpha);

}

```

};  
/////////////////////////////////////////////////////////// **Sub page functions**  
function slideClip(target) {  
var slideAway\_tween:Object = new Tween(\_root.container.holder, “\_x”, Back.easeIn, 180, 0, 1, true);  
slideAway.onMotionFinished = function() {

```
	_root.container.holder.attachMovie(target, "target", _root.getNextHighestDepth());
	var slideIn_tween:Object = new Tween(_root.container.holder, "_x", Elastic.easeOut, 0, 180, 1, true);
}

```

};

/////////////////////////////////////////////////////////// **Main page Nav**

rollClip(“about\_mc”);

navMain.aboutBtn.onRelease = function () {  
rollClip(“about\_mc”);  
}

navMain.packagesBtn.onRelease = function () {  
rollClip(“packages\_mc”);  
}

navMain.photoBtn.onRelease = function () {  
rollClip(“photos\_mc”);  
}

navMain.videoBtn.onRelease = function () {  
rollClip(“videos\_mc”);  
}

navMain.contactBtn.onRelease = function () {  
rollClip(“contact\_mc”);  
}

navMain.gbookBtn.onRelease = function () {  
rollClip(“gbook\_mc”);  
}

/////////////////////////////////////////////////////////// **Sub page Nav**  
container.holder. packages\_mc.dancedetailsBtn.onRelease = function () {  
slideClip(“danceDetail\_mc”);  
}

container.holder.packages\_mc.valuedetailsBtn.onRelease = function () {  
slideClip(“valueDetail\_mc”);  
}
