Skip to main content
Participating Frequently
April 24, 2006
Answered

Help ... path loading problem

hi all,
have u ever experience this problem?

I wrote a swf which loading bunch of external files (swf that contains sound file) like below:

function soundSetup() {
for (i=1; i<=numItem; i++) {
for (j=1; j<=subItem; j++) {
var obj = eval("core.set_"+i+"._"+j);
str = "1_2_"+i+j+".swf";
loadMovie(str, obj.clip);
core.LP.core_btn.onRelease = function() {
};
obj.core_btn.onRelease = function() {
itemOnRelease(this);
};
}
}
}

it works completely fine as a standalone file, it also works fine when i play it in Dreamweaver,
but when I test on just the html, I can't hear the sound anymore, the code is just like normal:
<object classid="clsid 27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="500" height="410">
<param name="movie" value="../swf/1_2/tones.1.2.swf">
<param name="quality" value="high">
<embed src="../swf/1_2/tones.1.2.swf" quality="high" pluginspage=" http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="500" height="410"></embed></object>

does anyone know why?
Thanks many....
This topic is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
April 27, 2006
the default path when loading objects into flash starts from the same folder as the html file that loads the _level0 swf. you sound files are not in that folder and that's why you're having trouble. there are a number of remedies including specifying the folder to use when loading your swfs that contain the sounds or putting the swfs that contain the sounds in the same folder as the html file used to load your _level0 swf.

11 replies

kglad
Community Expert
Community Expert
May 6, 2006
you're welcome.
Translate
kglad
Community Expert
Community Expert
April 26, 2006
i don't see a code problem but you should have numItem x subItem movieclips each of which contains movieclips core_btn (not a true button) and clip. if that's true, post a link to your main fla and one of your str swfs that demonstrate the problem.
Translate
diorkAuthor
Participating Frequently
April 27, 2006
http://ihome.ust.hk/~ctross/Sample.zip

I have created 2 folder, one works and one doesn't work (desire structure)
please advice.
Thanks a lot.
Translate
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
April 27, 2006
the default path when loading objects into flash starts from the same folder as the html file that loads the _level0 swf. you sound files are not in that folder and that's why you're having trouble. there are a number of remedies including specifying the folder to use when loading your swfs that contain the sounds or putting the swfs that contain the sounds in the same folder as the html file used to load your _level0 swf.
Translate
kglad
Community Expert
Community Expert
April 25, 2006
ok, where's your loadMovie() statement that loads your external swfs and what code are you using to direct the movieclip clip to play?
Translate
diorkAuthor
Participating Frequently
April 26, 2006
Here loads the sound (loadMovie)

function soundSetup() {
for (i=1; i<=numItem; i++) {
for (j=1; j<=subItem; j++) {
var obj = eval("core.set_"+i+"._"+j);
str = "1_2_"+i+j+".swf";
loadMovie(str, obj.clip);
obj.core_btn.onRelease = function() {
itemOnRelease(this);
};
}
}
}

And it plays similar to this

function itemOnRelease(obj){
obj._parent.clip.play();
}
Translate
kglad
Community Expert
Community Expert
April 24, 2006
your sound is attached to a frame in the external swfs? and there's a stop(), that prevents the frames that contain the sound from playing? if so, what code enables that timeline to play and the sound to play?
Translate
diorkAuthor
Participating Frequently
April 25, 2006
> your sound is attached to a frame in the external swfs? and there's a stop(), that prevents the frames that contain the sound from playing?

yes, say after it was loaded from _root.clip, then i will call _root.clip.play() to play whenever i want.
Translate
kglad
Community Expert
Community Expert
April 24, 2006
the swfs that contain sound files use attachSound()? if so, use whatever= new Sound(this), when you instantiate your sound class.
Translate
diorkAuthor
Participating Frequently
April 24, 2006
thanks kglad,
but those sound swfs only contain a stop() script and a sound file, plus some script at the end frame

actually, if i place my player.swf file in the same folder of the html file, it works completely fine
but since i want to put the files separately in /html and /swf folder, i would need to handle this problem....
Translate