# Animation doesn't play when swf is loaded using loadMovie

**URL:** <https://forum.kirupa.com/t/animation-doesnt-play-when-swf-is-loaded-using-loadmovie/261050>\
**Category:** flash\
**Created:** [May 22, 2008, 4:59pm UTC](https://forum.kirupa.com/t/animation-doesnt-play-when-swf-is-loaded-using-loadmovie/261050 "2008-05-22T16:59:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![victorcorey](https://avatars.discourse-cdn.com/v4/letter/v/e480ec/32.png) [@victorcorey](https://forum.kirupa.com/u/victorcorey)\
**Post date:** [May 22, 2008, 4:59pm UTC](https://forum.kirupa.com/t/animation-doesnt-play-when-swf-is-loaded-using-loadmovie/261050/1 "2008-05-22T16:59:51Z")

</div>

EXTERNAL SWF (works by itself)

this.onLoad = function() {  
this.base\_mc.onRollOver = function() { gotoAndPlay(1); };  
this.base\_mc.onRollOut = function() { gotoAndPlay(13); };  
};

MAIN SWF (external swf no longer works when loaded here)

var games = new Array();  
var gamesXML = new XML();  
gamesXML.ignoreWhite=true;  
gamesXML.load(“games.xml”);  
gamesXML.onLoad = function(success) {  
if (success){  
var game = gamesXML.firstChild.childNodes;  
for (i=0; i \< game.length; i++) {  
var gameTitle = game\*.attributes.title;  
var gameAsset = game\*.attributes.asset;  
var gameLink = game\*.attributes.link;  
games\*=new Array(gameTitle,gameAsset,gameLink);  
}  
loadGames();  
}  
};  
this.loadGames = function() {  
for(i=0;i\<games.length;i++){  
this[“game”+i+"\_mc"].name\_txt.text=games\*[0];  
this[“game”+i+"\_mc"].background\_mc.loadMovie(games\*[1]);  
this[“game”+i+"\_mc"].gameLink = games\*[2];  
}  
};

---

<div class="post-metadata">

**Author:** ![shotymac](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@shotymac](https://forum.kirupa.com/u/shotymac)\
**Post date:** [May 22, 2008, 9:10pm UTC](https://forum.kirupa.com/t/animation-doesnt-play-when-swf-is-loaded-using-loadmovie/261050/2 "2008-05-22T21:10:00Z")

</div>

[quote=victorcorey;2329616]EXTERNAL SWF (works by itself)

this.onLoad = function() {  
this.base\_mc.onRollOver = function() { gotoAndPlay(1); };  
this.base\_mc.onRollOut = function() { gotoAndPlay(13); };  
};

MAIN SWF (external swf no longer works when loaded here)

var games = new Array();  
var gamesXML = new XML();  
gamesXML.ignoreWhite=true;  
gamesXML.load(“games.xml”);  
gamesXML.onLoad = function(success) {  
if (success){  
var game = gamesXML.firstChild.childNodes;  
for (i=0; i \< game.length; i++) {  
var gameTitle = game\*.attributes.title;  
var gameAsset = game\*.attributes.asset;  
var gameLink = game\*.attributes.link;  
games\*=new Array(gameTitle,gameAsset,gameLink);  
}  
loadGames();  
}  
};  
this.loadGames = function() {  
for(i=0;i\<games.length;i++){  
this[“game”+i+"\_mc"].name\_txt.text=games\*[0];  
this[“game”+i+"\_mc"].background\_mc.loadMovie(games\*[1]);  
this[“game”+i+"\_mc"].gameLink = games\*[2];  
}  
};[/quote]

Can you post the file so I can take a look at it. or post how the xml is structured as I assume the xml contains the paths for the swfs to be loaded. It is most likely a scope issue, but I need a little more info to be sure.

Sean

---

<div class="post-metadata">

**Author:** ![victorcorey](https://avatars.discourse-cdn.com/v4/letter/v/e480ec/32.png) [@victorcorey](https://forum.kirupa.com/u/victorcorey)\
**Post date:** [May 22, 2008, 9:36pm UTC](https://forum.kirupa.com/t/animation-doesnt-play-when-swf-is-loaded-using-loadmovie/261050/3 "2008-05-22T21:36:14Z")

</div>

I was able to get it to work by changing the path in the external swf to:

\_level0.game0\_mc.background\_mc.base\_mc.onRollOver = function() { gotoAndPlay(1); };

but this seems kind of hacky.
