0
Engaged
,
/t5/animate-discussions/using-external-swf-linkage-audio/td-p/116634
Sep 01, 2008
Sep 01, 2008
Copy link to clipboard
Copied
Because flash doesn't loop external mps file correctly, there
is always a pause in the loop. The work around is to load the AIFF,
or WAV, file into the .fla and let Flash compress the audio file,
then the loop works without the pause. The problem with this is
that when I have many music loops it takes a long time to publish
and test, so in AS 2 I would publish .swfs that compressed the raw
audio file and gave the audio file a linkage. Then I would load the
.swf into the main .swf and access the loaded .swfs linkage file.
The code looked like this:
_root.createEmptyMovieClip ("soundsMC",_root.soundsMC.getNextHighestDepth ());
instructionsContainer = _root.soundsMC.createEmptyMovieClip ("instructionsContainer", _root.soundsMC.getNextHighestDepth ());
instructions = new Sound (instructionsContainer);
instructions.attachSound ("instructions theme");
This worked perfectly. But this method does not work in AS3.
This is what I've tried in AS3:
_root.createEmptyMovieClip ("soundsMC",_root.soundsMC.getNextHighestDepth ());
instructionsContainer = _root.soundsMC.createEmptyMovieClip ("instructionsContainer", _root.soundsMC.getNextHighestDepth ());
instructions = new Sound (instructionsContainer);
instructions.attachSound ("instructions theme");
This worked perfectly. But this method does not work in AS3.
This is what I've tried in AS3:
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Engaged
,
Sep 01, 2008
Sep 01, 2008
by just moving code around I got it to work. I changed this
line:
var FishHoleOldMusicMCClass:Class = libMedia.loaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
To this:
var FishHoleOldMusicMCClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
this is the code:
public function initView ():void {
loader = new Loader ();
targetStage.addChild (loader);
loader.contentLoaderInfo.addEventListener (Event.INIT, loarderLoad...
var FishHoleOldMusicMCClass:Class = libMedia.loaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
To this:
var FishHoleOldMusicMCClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
this is the code:
public function initView ():void {
loader = new Loader ();
targetStage.addChild (loader);
loader.contentLoaderInfo.addEventListener (Event.INIT, loarderLoad...
Engaged
,
LATEST
/t5/animate-discussions/using-external-swf-linkage-audio/m-p/116635#M2656
Sep 01, 2008
Sep 01, 2008
Copy link to clipboard
Copied
by just moving code around I got it to work. I changed this
line:
var FishHoleOldMusicMCClass:Class = libMedia.loaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
To this:
var FishHoleOldMusicMCClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
this is the code:
public function initView ():void {
loader = new Loader ();
targetStage.addChild (loader);
loader.contentLoaderInfo.addEventListener (Event.INIT, loarderLoaded);
loader.load (new URLRequest("sound/fishhole_old.swf"));
}
//
private function loarderLoaded (event:Event):void {
trace ("loarderLoaded");
loader.contentLoaderInfo.removeEventListener (Event.INIT, loarderLoaded);
var FishHoleOldMusicMCClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
var music = new FishHoleOldMusicMCClass();
music.play(0, 1000);
}
var FishHoleOldMusicMCClass:Class = libMedia.loaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
To this:
var FishHoleOldMusicMCClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
this is the code:
public function initView ():void {
loader = new Loader ();
targetStage.addChild (loader);
loader.contentLoaderInfo.addEventListener (Event.INIT, loarderLoaded);
loader.load (new URLRequest("sound/fishhole_old.swf"));
}
//
private function loarderLoaded (event:Event):void {
trace ("loarderLoaded");
loader.contentLoaderInfo.removeEventListener (Event.INIT, loarderLoaded);
var FishHoleOldMusicMCClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("FishHoleOldMusicMC") as Class;
var music = new FishHoleOldMusicMCClass();
music.play(0, 1000);
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

