Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using External .swf Linkage Audio

Engaged ,
Sep 01, 2008 Sep 01, 2008
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:

TOPICS
ActionScript
357
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 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...
Translate
Engaged ,
Sep 01, 2008 Sep 01, 2008
LATEST
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);
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines