PDA

View Full Version : Random loadMovie function - problem with location of external SWFs



calitswa
April 5th, 2005, 02:05 PM
Hi,

I'm having a problem with embedding a Flash movie that loads an array of SWFs- specifically, ones that exist in the same movie as the .fla loader file.

When I move the external SWFs and .swf load_movie file into a separate directory from the HTML file, they do not load properly. I get just a white window, and am not sure how to solve this .

http://www.calit2.net/newwebsite/index_css_conversion3.html

When I keep the SWF movie clips and load_movie.swf in the same (root) folder as the .html file, then everything loads properly, though. But this would extremely clutter up my directory!

The code is as follows:

MOVIE CLIP ON STAGE

Attach Code

onClipEvent(data){
//test to make sure it's completely loaded, when swf's load this way onData is called with each 'chunk' of data
if(bytesLoaded()==bytesTotal()){
this.onEnterFrame=function(){
if(_currentframe==_totalframes){
_root.loadNextMovie()
}
}

FIRST FRAME OF TIMELINE - ACTIONS LAYER

filename = ["agilent.swf", "amcc.swf", "ampersand.swf", "alliance.swf", "analog.swf", "avalon.swf", "att.swf", "archventure.swf", "boeing.swf", "awarepoint.swf", "broadcom.swf", "bigbangwidth.swf", "bluetitan.swf", "butterfly.swf", "broadleyjames.swf", "calamp.swf", "calbatech.swf", "calient.swf"];
loadNextMovie = function () {
trace("loadnext");
movieTarget.loadMovie(filename[random(filename.length)]);
};
loadNextMovie();
}
}

HTML CODE:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="168" height="113" id="load_randomMX" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="load/movie/load_randomMX.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="load_movie/load_randomMX.swf" quality="high" bgcolor="#ffffff" width="168" height="113" name="load_randomMX" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


I 'm not sure if there is a way in loadMovie to specify another folder, or the best way to solve this problem. I'm relatively new to Actionscript.

Any help is appreciated, thanks!

lunatic
April 5th, 2005, 02:13 PM
If all your external swfs are in one directory themselves you should be able to include the directory name in this line of code:


movieTarget.loadMovie(filename[random(filename.length)]);

so it would look like this


movieTarget.loadMovie(diretoryName/filename[random(filename.length)]);

If not then you could also add the directory name in front of every file name:


filename = ["diretoryName/agilent.swf", "diretoryName/amcc.swf", "diretoryName/ampersand.swf", "diretoryName/alliance.swf", "diretoryName/analog.swf", "diretoryName/avalon.swf", "diretoryName/att.swf", "diretoryName/archventure.swf", "diretoryName/boeing.swf", "diretoryName/awarepoint.swf", "diretoryName/broadcom.swf"]

etc.

Hope this helps!
:hr:

calitswa
April 5th, 2005, 03:21 PM
Wow! works great...it's funny when you're trying to get your head around how something is working how simple the solution can be..thanks!


If all your external swfs are in one directory themselves you should be able to include the directory name in this line of code:


movieTarget.loadMovie(filename[random(filename.length)]);

so it would look like this


movieTarget.loadMovie(diretoryName/filename[random(filename.length)]);

If not then you could also add the directory name in front of every file name:


filename = ["diretoryName/agilent.swf", "diretoryName/amcc.swf", "diretoryName/ampersand.swf", "diretoryName/alliance.swf", "diretoryName/analog.swf", "diretoryName/avalon.swf", "diretoryName/att.swf", "diretoryName/archventure.swf", "diretoryName/boeing.swf", "diretoryName/awarepoint.swf", "diretoryName/broadcom.swf"]

etc.

Hope this helps!
:hr:

lunatic
April 5th, 2005, 04:11 PM
welcome =)