I'm having a problem getting loadMovie to load my external SWF consistantly. The problem is intermitant (maybe a cache issue, though I clear it). When the problem happens, it can usually be fixed by hitting refresh. I'm using loadMovie to load an external SWF file, which is listed in an XML file. It's an XML audio player. I've had my buddies test it, and it happens about 1/4 of the time.
When it loads, I've created two dynamic text boxes to track the frame number of the movie that contains the code for my XML loader and loadMovie loader - and the number of frames loaded for my audio. I've divided the code up into more frames than needed, just to try and isolate it.
Here's the player (it's embedded below, but here's the link if you want to refresh it):
http://www.aspirin99.com/mp3/bluePlayer.html
Here's the code giving me trouble:
//Frame One
// Load XML Data
_root.songList = new XML();
_root.songList.ignoreWhite = true;
_root.songList.load("song_list.xml");
_root.songList.onLoad = function(success) {
_root.nodeNum=0;
_root.listLoaded=1;
_root.musicHolder.loadMovie(_root.songList.firstChild.childNodes[_root.nodeNum].attributes.src);
}
//I have the loadMovie in here twice because if fails less often with it in the code twice.
//
//Frame Two:
//
if (_root.listLoaded==1) {
checkForEnd=_root.songList.firstChild.childNodes[_root.nodeNum].attributes.src;
if (checkForEnd==undefined) {
_root.nodeNum=0;
}
} else {
gotoAndPlay(1);
}
//
//Frame Four: Labeled "wait"
//
_root.musicHolder.loadMovie(_root.songList.firstChild.childNodes[_root.nodeNum].attributes.src);
//
//Frame Six: // Does an animation if at least 10 frames are loaded or keeps trying to load.
//
if (_root.musicHolder._framesLoaded>10) {
_root.cover.gotoAndPlay(10);
} else {
gotoAndPlay("wait");
}
//
//Frame Seven:
stop();
- //Frame One
- // Load XML Data
- _root.songList = new XML();
- _root.songList.ignoreWhite = true;
- _root.songList.load("song_list.xml");
- _root.songList.onLoad = function(success) {
- _root.nodeNum=0;
- _root.listLoaded=1;
- _root.musicHolder.loadMovie(_root.songList.firstChild.childNodes[_root.nodeNum].attributes.src);
- }
- //I have the loadMovie in here twice because if fails less often with it in the code twice.
- //
- //Frame Two:
- //
- if (_root.listLoaded==1) {
- checkForEnd=_root.songList.firstChild.childNodes[_root.nodeNum].attributes.src;
- if (checkForEnd==undefined) {
- _root.nodeNum=0;
- }
- } else {
- gotoAndPlay(1);
- }
- //
- //Frame Four: Labeled "wait"
- //
- _root.musicHolder.loadMovie(_root.songList.firstChild.childNodes[_root.nodeNum].attributes.src);
- //
- //Frame Six: // Does an animation if at least 10 frames are loaded or keeps trying to load.
- //
- if (_root.musicHolder._framesLoaded>10) {
- _root.cover.gotoAndPlay(10);
- } else {
- gotoAndPlay("wait");
- }
- //
- //Frame Seven:
- stop();
Here's the file embed here, but you'll probable need to see it at the link above so you can refresh it.
[flash width=500 height=100 loop=false]http://www.aspirin99.com/mp3/bluePlayer.swf[/flash]
edit to add one more thing- It's early in the build. The buttons will change, the font will change, etc. I'm just trying to get it functional.
edit- changed height of embedded swf