# Load external SWF when even is triggered

**URL:** <https://forum.kirupa.com/t/load-external-swf-when-even-is-triggered/253643>\
**Category:** Uncategorized\
**Created:** [March 3, 2008, 7:26pm UTC](https://forum.kirupa.com/t/load-external-swf-when-even-is-triggered/253643 "2008-03-03T19:26:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![showerx](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@showerx](https://forum.kirupa.com/u/showerx)\
**Post date:** [March 3, 2008, 7:26pm UTC](https://forum.kirupa.com/t/load-external-swf-when-even-is-triggered/253643/1 "2008-03-03T19:26:31Z")

</div>

Im going to repost this question but simplify it, I read this post afterwards and it even confused me…  
I not sure how to delete it.

* * *

Hello every one.  
I have 3 movie clips that are being used like a button, they appear in the middle of the screen, when clicked on the 3 movies move to the left of the screen.  
the top movie clip is at x: 30 y: 180  
the middle movie clip is at x: 30 y:345  
the bottom clip is at x: 30 y: 510  
if you click on the middle clip, it moves to the postion of the top clip,  
the top click then movies to the bottom, and the bottom moves to the middle  
if you click on the bottom clip, it moves to the top, the middle clip moves to the bottom, and the top clip moves to the middle.  
basicly the 3 clips cycle positions, depending on what clip the user clicks on, the button that was clicked on moves to the top.

THE PROBLEM…  
I want to load an external movie clip. I want the clip to load when the the movie clip that the user cliced on moves to the top postion x: 30 y: 180,

THE CODE…  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// VARS  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// DESIGNATION THE POSTITIONS OF THE LEFT SIDE STACKED BUTTONS…  
var topXstack = 30; //left position of stacked icons  
var top1Ystack = 180; //top most  
var top2Ystack = 345; //middle  
var top3Ystack = 510; //bottom  
// DESIGNATION THE POSTITIONS OF THE START BUTTONS…  
var startY = 257;  
var startLX = 102; // left  
var startMX = 326; // middle  
var startRX = 550; // right  
// VARS \>\> STARTING POSTITIONS OF BUTTONS  
var designXpos = design\_mc.\_x; //origonal start postition  
var designYpos = design\_mc.\_y; //origonal start postition  
var aboutXpos = about\_mc.\_x; //origonal start postition  
var aboutYpos = about\_mc.\_y; //origonal start postition  
var contactXpos = contact\_mc.\_x; //origonal start postition  
var contactYpos = contact\_mc.\_y; //origonal start postition  
//STACK ORDER VAR, SO THE SELECTED BUTTON STAYS ON TOP OF STACKING VIEW  
var stack:Number = 1;  
// ALPHA FUNCTIONS TO FADE IN REFLECTIONS  
import mx.transitions.Tween;  
import mx.transitions.easing.\*;  
// VAR FOR EXTERNAL SWF  
var startSwf:Boolean = false;

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// EASING and LOADING SWF using onEnterFrame  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
design\_mc.onEnterFrame = function()  
{  
this.\_x = this.\_x - (this.\_x - designXpos)/8;  
this.\_y = this.\_y - (this.\_y - designYpos)/8;

{ if( designYpos.\_y == top1Ystack ) // TAKE CURRENT Y POSITION  
// design\_mc, and if its equal to  
{ startSwf = true; // top1Ystack, then the value is true  
}  
if(startSwf =true)  
{ \_parent.createEmptyMovieClip(“container\_mc”,  
\_parent.getNextHighestDepth());  
container\_mc.loadMovie(“slideshow.swf”);  
}  
}  
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
CODE THAT I TRIED TO GET TO WORK WITH EXTERNAL SWF

if(this.\_y \<= top1Ystack)  
{ this.createEmptyMovieClip(“container\_mc”, this.getNextHighestDepth());  
container\_mc.loadMovie(“slideshow.swf”);  
}

{  
//trace(“please work please please”);  
// CREATES EMPTY CONTAINER TO HOLD CLIP  
loadMovie(“slideshow.swf”,container\_mc); // Load external SWF  
// container\_mc.\_x = 190; // Container’s positions on stage  
//container\_mc.\_y = 190;  
}  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

about\_mc.onEnterFrame = function()  
{  
this.\_x = this.\_x - (this.\_x - aboutXpos)/8;  
this.\_y = this.\_y - (this.\_y - aboutYpos)/8;  
}

contact\_mc.onEnterFrame = function()  
{  
this.\_x = this.\_x - (this.\_x - contactXpos)/8;  
this.\_y = this.\_y - (this.\_y - contactYpos)/8;  
}

//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// ORDER OF MOVEMENT…FROM THE START POSITION, MOVING TO THE LEFT SIDE  
//\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
design\_mc.onRelease = function()  
{  
// SETS THE STACK ORDER  
{ stack++; //ADDING + 1 TO THE VAR CALLED STACK ORDER FOR ABOUT\_MC  
this.swapDepths(stack); // THIS PUTS THE CURRENT BUTTON ON TOP OF THE VIEW OF THE OTHERS

if(this.swapDepths = 3)  
{ about\_mc.swapDepths(2);  
contact\_mc.swapDepths(1);  
}

}

// FADES OUT THE REFLECTIONS MOVIE CLIPS  
var fade\_mcl3:Object = new Tween(designR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)  
var fade\_mcl3:Object = new Tween(aboutR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)  
var fade\_mcl3:Object = new Tween(contactR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)

/\* SETS POSITIONS FOR LEFT SIDE BUTTON ORDER TOP TO BOTTOM, WHEN THE BUTTON IS CLICKED, IT GOES TO THE  
TOP AND THE OTHER TWO BUTTONS FOLLOW IN ORDER UNDERNEATH \*/  
designXpos = topXstack;  
designYpos = top1Ystack;  
aboutXpos = topXstack;  
aboutYpos = top2Ystack;  
contactXpos = topXstack;  
contactYpos = top3Ystack;  
if(this = top2Ystack) // IF BUTTON IS AT THE MIDDLE AND CLICKED ON, MOVE TO THE TOP  
{ designYpos = top1Ystack;  
aboutYpos = top2Ystack;  
contactYpos = top3Ystack;  
}  
if(this = top3Ystack) // IF BUTTON IS AT THE BOTTOM AND CLICKED ON, MOVE TO THE TOP  
{ designYpos = top1Ystack;  
aboutYpos = top2Ystack;  
contactYpos = top3Ystack;  
}

}

about\_mc.onRelease = function()  
{  
// SETS THE STACK ORDER  
{ stack++; //ADDING + 1 TO THE VAR CALLED STACK ORDER FOR ABOUT\_MC  
this.swapDepths(stack); // THIS PUTS THE CURRENT BUTTON ON TOP OF THE VIEW OF THE OTHERS

if(this.swapDepths = 3)  
{ contact\_mc.swapDepths(2);  
design\_mc.swapDepths(1);  
}  
}

// FADES OUT THE REFLECTIONS MOVIE CLIPS  
var fade\_mcl3:Object = new Tween(designR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)  
var fade\_mcl3:Object = new Tween(aboutR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)  
var fade\_mcl3:Object = new Tween(contactR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)

/\* SETS POSITIONS FOR LEFT SIDE BUTTON ORDER TOP TO BOTTOM, WHEN THE BUTTON IS CLICKED, IT GOES TO THE  
TOP AND THE OTHER TWO BUTTONS FOLLOW IN ORDER UNDERNEATH \*/  
aboutXpos = topXstack;  
aboutYpos = top1Ystack;  
contactXpos = topXstack;  
contactYpos = top2Ystack;  
designXpos = topXstack;  
designYpos = top3Ystack  
if(this = top2Ystack) // IF THIS BUTTON IS AT THE MIDDLE AND CLICKED ON, MOVE TO THE TOP  
{ aboutYpos = top1Ystack;  
contactYpos = top2Ystack  
designYpos = top3Ystack;

}  
if(this = top3Ystack) // IF THIS BUTTON AT THE BOTTOM AND CLICKED ON, MOVE TO THE TOP  
{ aboutYpos = top1Ystack;  
contactYpos = top2Ystack  
designYpos = top3Ystack;

}

}

contact\_mc.onRelease = function()  
{  
// SETS THE STACK ORDER  
{ stack++; //ADDING + 1 TO THE VAR CALLED STACK ORDER FOR ABOUT\_MC  
this.swapDepths(stack); // THIS PUTS THE CURRENT BUTTON ON TOP OF THE VIEW OF THE OTHERS

if(this.swapDepths = 3)  
{ design\_mc.swapDepths(2);  
about\_mc.swapDepths(1);  
}  
}

// FADES OUT THE REFLECTIONS MOVIE CLIPS  
var fade\_mcl3:Object = new Tween(designR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)  
var fade\_mcl3:Object = new Tween(aboutR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)  
var fade\_mcl3:Object = new Tween(contactR\_mc,"\_alpha", Strong.easeOut, 100, 0, 2, true)

/\* SETS POSITIONS FOR LEFT SIDE BUTTON ORDER TOP TO BOTTOM, WHEN THE BUTTON IS CLICKED, IT GOES TO THE  
TOP AND THE OTHER TWO BUTTONS FOLLOW IN ORDER UNDERNEATH \*/  
contactXpos = topXstack;  
contactYpos = top1Ystack;  
designXpos = topXstack;  
designYpos = top2Ystack;  
aboutXpos = topXstack;  
aboutYpos = top3Ystack  
if(this = top2Ystack) // IF THIS BUTTON IS AT THE MIDDLE AND CLICKED ON, MOVE TO THE TOP  
{ contactYpos = top1Ystack  
designYpos = top2Ystack;  
aboutYpos = top3Ystack;

}  
if(this = top3Ystack) // IF THIS BUTTON AT THE BOTTOM AND CLICKED ON, MOVE TO THE TOP  
{ contactYpos = top1Ystack  
designYpos = top2Ystack;  
aboutYpos = top3Ystack;

}  
}

SORRY ABOUT THE WRAPPING, the copy and paste messed it up…  
If any one can help that would be great
