Hi,
I've been struggling to get sounds to work with attachSound when the sounds are stored in a swf loaded into another swf. I came across a post on a forum which supposedly explains how to to do it, however i tryed what it suggested and it doesn't work. (link)
I then tryed to use the MovieClipLoader class so that once the swf was loaded the sound would be played. What is strange though is that when the swf has loaded i can return a valid reference to the sound object, but cannot play it. This is all local, so it should play. I'm very confused.
Here is my code:
sound.swf - beep_sound.wav file is in the library with linkage identifier beep_sound
player.swf
The trace output is:
Thanks,
Chromis
I've been struggling to get sounds to work with attachSound when the sounds are stored in a swf loaded into another swf. I came across a post on a forum which supposedly explains how to to do it, however i tryed what it suggested and it doesn't work. (link)
I then tryed to use the MovieClipLoader class so that once the swf was loaded the sound would be played. What is strange though is that when the swf has loaded i can return a valid reference to the sound object, but cannot play it. This is all local, so it should play. I'm very confused.
Here is my code:
sound.swf - beep_sound.wav file is in the library with linkage identifier beep_sound
Code:
_global.my_beep_sound = new Sound();
my_beep_sound.attachSound("beep_sound");
trace("Sound file loaded"+my_beep_sound);
Code:
// create an empty movie clip
this.createEmptyMovieClip("my_mc", this.getNextHighestDepth());
// Create Movie clip loader for sound
var my_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
// Setup events for preloader
mclListener.onLoadStart = function(target_mc:MovieClip):Void {
};
mclListener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
};
mclListener.onLoadComplete = function(target_mc:MovieClip):Void {
};
mclListener.onLoadInit = function(target_mc:MovieClip):Void {
trace("init");
trace(my_beep_sound);
my_beep_sound.start(0,999);
};
my_mcl.addListener(mclListener);
// Load sound
my_mcl.loadClip("sound.swf",my_mc);
Code:
Sound file loaded: [object Object] init [object Object]
Chromis
Comment