# Loading swf in swf

**URL:** <https://forum.kirupa.com/t/loading-swf-in-swf/34119>\
**Category:** Uncategorized\
**Created:** [October 28, 2003, 12:12pm UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119 "2003-10-28T12:12:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![G\_1](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@G\_1](https://forum.kirupa.com/u/G_1)\
**Post date:** [October 28, 2003, 12:12pm UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119/1 "2003-10-28T12:12:03Z")

</div>

hey

im making a photo gallery  
but i made it in a different swf file then the rest  
(else it wont work at all)  
everything works separatly, only if i load the swf file which contains  
the foto gallery in the main movie, it doesnt display the pictures only the guide-buttons…?

howcome…?

i read the Photo gallery tutorial on kirupa, again it works seperatly but if i place it into the main movie, it doesnt work at all…

thx for lettin me post my freaky faq… xx  
latrz

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 28, 2003, 12:26pm UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119/2 "2003-10-28T12:26:49Z")

</div>

[![](http://www.kirupaforum.com/images/search_top.gif)](http://www.kirupaforum.com/forums/search.php?s=) will help 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 28, 2003, 9:36pm UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119/3 "2003-10-28T21:36:51Z")

</div>

thx  
xx

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 6, 2003, 3:12am UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119/4 "2003-11-06T03:12:19Z")

</div>

i did the same thing, similar to you…except, i did Dynamic text instead of picutres…  
i have a index.swf and it loads another movie called about.swf

the about.swf has a dynamic text box with stuff inside and a scroll bar. how come when i load the about.swf into the a blank movie clip in index.swf i only get the scroll bar showing?!  
help! this problem is killingme

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 6, 2003, 1:30pm UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119/5 "2003-11-06T13:30:06Z")

</div>

this is my actionscript for the button that you click to load the external .swf file…

on (release) {  
\_root.createEmptyMovieClip(“emptyMC”, 1);  
\_root.emptyMC.\_x = 150;  
\_root.emptyMC.\_y = 100;  
\_root.emptyMC.loadMovie(“photogallery.swf”);  
}

hope you can use this…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2003, 5:48pm UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119/6 "2003-11-08T17:48:51Z")

</div>

i imitated the fading grid effect on kirupa, it can found by going to “search” then typing in “fading grid” …and i made it into its own little .swf  
now i tried to load it from a main.swf and noting comes up, the movie loads into the empty MC but the animation does not start.

help!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2003, 6:14pm UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119/7 "2003-11-08T18:14:42Z")

</div>

Not looking at the code,  
but I would guess all your problems are path-related,  
means that if in the loaded swf, there’s references to \_root,  
it might not work anymore when loaded into another swf…  
check the code for that, try \_parent instead…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2003, 6:20pm UTC](https://forum.kirupa.com/t/loading-swf-in-swf/34119/8 "2003-11-08T18:20:40Z")

</div>

err, that didn’t work…  
here is the code for the fading grid…i pulled it right off the tutorial on this site.

//Declare variables  
xspacing = box.\_width;  
yspacing = box.\_height;  
depth = 0;  
box.\_visible = 0;  
azcount = 0;  
smoothness = 90;  
//Calculate positions and values  
amH = Math.ceil(image.\_width/box.\_width);  
amV = Math.ceil(image.\_height/box.\_height);  
border.\_height = image.\_height+1;  
border.\_width = image.\_width+1;  
border.\_x = image.\_x-0.5;  
border.\_y = image.\_y-0.5;  
//Create grid  
for (i=0; i\<amH; i++) {  
for (var k = 0; k\<amV; k++) {  
box.duplicateMovieClip(“box”+depth, depth);  
cur = this[“box”+depth];  
cur.\_x = image.\_x+(xspacing_i);  
cur.\_y = image.\_y+(yspacing_k);  
depth++;  
}  
}  
//  
//  
// End of grid  
//  
//  
function fadeOut(startboxnr, speed) {  
fadeMC(startboxnr, speed);  
}  
function fadeMC(mcnr, speed) {  
azcount++;  
\_root[“box”+mcnr].onEnterFrame = function() {  
\_root[“box”+mcnr].\_alpha -= speed;  
if (\_root[“box”+mcnr].\_alpha\<=smoothness) {  
\_root[“box”+mcnr].onEnterFrame = null;  
continueFade(\_root[“box”+mcnr], speed);  
mcnr += 1;  
fadeOut(mcnr, speed);  
}  
};  
}  
function continueFade(mc, speed) {  
mc.onEnterFrame = function() {  
mc.\_alpha -= speed;  
if (mc.\_alpha\<=0) {  
delete mc.onEnterFrame;  
}  
};  
}  
fadeOut(0, 5);

like you said I changed the \_roots to \_parent and tired loading, the movie didn’t even do the effect and plus it didn’t show up when i loaded it into another .swf
