Stop the external external SWF sound

I'm working on the controls for an external swf. The external swf load an external audio file. The structure at the moment is

extswf.swf contains mcSound that loads soundfile.mp3. extswf.SWF playback starts automatically when it is called.

movieController contains the icons for the buttons play/pause. This is attributed to CntlClass.

CntlClass load extswf.swf and control buttons play / pause.

So far, the play buttons / break stop and start and stop the film, but not the sound. I know that I need to access the sound from the external swf channel and sound transformation allows you to change the volume. We know not how to access this channel.

The examples that I think have integrated audio files. Also, the examples seem to use the main class for the external swf. My external swf is not a class file, so I have no idea what would be the main class.

If someone has done this successfully, who would be willing to share?

you follow my suggestion.  use:

SerializableAttribute public class CntlClass extends MovieClip
{
public var loader: Loader;
public var movie: MovieClip;

public void CntlClass()
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener (Event.COMPLETE, movieLoaded);
Loader.Load (new URLRequest ("extswf.swf"));

mcPlay.buttonMode = true;
mcPause.buttonMode = true;
mcPlay.visible = false;
}
       
public void movieLoaded(event:Event):void
{
film = MovieClip (loader.content);

loader.removeEventListener (Event.COMPLETE, movieLoaded);

stage.addChild (movie);
mcPause.addEventListener (MouseEvent.CLICK, pauseSWF);
}
          
public void pauseSWF(event:MouseEvent_=_null):void
{
Movie.Stop ();
       MovieClip (loader.content).channel.stop ();
mcPlay.visible = true;
mcPause.visible = false;
}

In extswf.swf:

var req:URLRequest = new URLRequest ("noise.mp3");
var sound: Sound = new Sound();
channel: var SoundChannel = new SoundChannel();

function soundLoaded(event:Event):void
{
sound.removeEventListener (Event.COMPLETE, soundLoaded);
channel = sound.play().
channel.addEventListener (Event.SOUND_COMPLETE, otherStuff);
}

function otherStuff(event:Event):void
{

Channel.Stop ();
channel.removeEventListener (Event.SOUND_COMPLETE, otherStuff);
}

sound.addEventListener (Event.COMPLETE, soundLoaded);
Sound.load() (req);

Tags: Adobe Animate

Similar Questions

  • Problem with the playback of the external SWF sound

    Hello

    I need to load the external SWF file, which contains the simple + audio image sequence. I used the MovieClipLoader class for this and also a preloader, where I check if I can run the SWF safely, without having to pause later and continue with loading. It works similar to video YouTube, where the video is buffered.

    The problem is that when I load the SWF file and run it, the audio start to play later. I tried more cases and the reason is that even if I load enough of the SWF, I can be certain I can start reading, because it is not enough for audio, if you start playing a little later. When I insert more, the audio begins to play immediately.

    So the question is, is there a way how can I check if the audio is loaded and ready to play?

    Thank you

    Michal

    If you can inspect the external swf fla enough to know that synchronize sound is set to stream, you should be able to look at the scenario where the sound is attached and determine the number of images, the sound is.

  • Loading and unloading of the external swf with buttons

    Alright. Here's the deal. I have 7 buttons on my main page, on the left side of the screen. I want the buttons to the external swf on the right to load and unload then when you push a different button. Should I make a table? Do I need a clip vacuum film to load each swf in?

    ///////////////Buttons/////////////////////

    graphics - load the thumbnail scroll bar

    mixed technique - load the thumbnail scroll bar

    photography - load the thumbnail scroll bar

    illustration - charge the miniature scroll bar

    Words - list history of charges

    Contact - contact information of charges

    charges about - bio

    ////////////////////////////////////////////

    Thanks for any help.

    If you are unable to publish for flash player 10, you will need to use the instead of unloadAndStop() unload() method.

  • How to use the external swf semi-transparent mask?

    I want to use the external swf semi-transparent mask for the smooth transition. I use

    clip.cacheAsBitmap = true;

    mask.cacheAsBitmap = true;

    clip.setMask (mask);

    Everything works fine. But when I use

    loadMovie ("http://www.url.com/movie.swf", "_root.clip");

    clip.cacheAsBitmap = true;

    mask.cacheAsBitmap = true;

    clip.setMask (mask);

    It does not work... What am I doing wrong?

    Well, if your loadMovie is on the same timeline as the code that you set as a mask, then you need not _root.

    And sorry, I forgot, there was a problem with the main mc of masking that loadMovie is load in. While I was doing was putting clip inside another mc and called as well as mc 'container' then my code would look like:

    masker.cacheAsBitmap = true;

    container.cacheAsBitmap = true;

    container.setMask (masker);

    container.clip.loadMovie ("movietoload.swf");

    Download two attached SWF files and open the main.swf to see.

  • poor quality than the external .swf

    Is this possible?

    using my main swf file, I want to load an external swf.

    I put the external swf to play in low quality with:

    _quality = "low";

    but when I play the main swf file, two video clips seem to inherit the same parameter.  They both play at the same quality.

    Can I do the main swf play high quality or average, while the external swf is down?

    Thank you

    Yes, you can do.

  • How to determine the total number of images in the external .swf file loaded

    I have to be able to load both external .swf files and make them play in order. To do this, I need to know the number of images in the first .swf file so I can check _currentframe against _totalframes to determine when he is finished playing so that I can load another.

    Most of the stuff I see indicate that _totalframes on an external .swf can be determined by loading the .swf in a container clip and then check using a listener in the .onLoadInit. Like this:

    ------------------------------------------------------------------------------------------ ----------------------------

    this.createEmptyMovieClip ("tester_mc", 1);
    var mcListener:Object = new Object();

    mcListener.onLoadInit = {function (target_mc:MovieClip)}
    target_mc.onEnterFrame = function() {}
    If (this ._currentframe > = this ._totalframes) {}
    trace ("total frames =" + this ._totalframes);
    delete this.onEnterFrame;
    } else {}
    trace (target_mc._currentframe + "OF" + target_mc._totalframes);
    }
    }
    }

    var test_mc:MovieClipLoader = new MovieClipLoader();
    test_mc. AddListener (mcListener);
    test_mc.loadClip ("Ad_Group.swf", tester_mc);

    ------------------------------------------------------------------------------------------ -------------------------------------

    Unfortunately, this doesn't seem to work. The trace will always return a total number of frames of 1.

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I would appreciate any ideas on how to raise the total number of frames of an external .swf file or, Alternatively, put it another way when it's done playing. (Not only the loading, but play until the end.)

    TIA,

    C

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I wouldn't imagine. My guess is that the main scenario for the external swf file has only 1 frame and the rest of the animation is inside a movieclip in this timeline. You publish this swf? Can you open the FLA and check how many images is open on the main timeline?

    The approach that you have mentioned is about what there is. But he knows check a chronology. If there are many nested movieclips, it may be impossible to understand what timeline you really want to be 'THE' full chronology.

    If you have the FLA, you can have the video call function on the _root timeline which tells the main swf that has completed a movieclip or something like that.

    Also, I have in my head somewhere that I recently saw something that someone made similar to this one, but do not remember... If it appears in my head that I will post.

  • Preloader which modifies the external SWF files every 5 seconds

    Hello

    I made a web banner in flash that loads an external swf and another external swf changes after 5 seconds. The banner have a preloader, but the problem becomes when you load the first time. As sovereign wealth funds are not cached in the cache of the browser and yet, time 5 seconds start counting from the preloader, and when the external swf file, shows only 1 second rest and it is replaced by another. There is a way to 'freeze' the time for each external swf until it loads completely?

    The code that loads SWFs every 5 seconds (this code is placed in a layer of action):

    start of the code:

    var intervalId: number;
    var: number = 0;
    var maxCount:Number = 23;
    var duration: number = 0;
    var banners: Array = new Array)
    "abatrade.swf,"
    "bancobrasil.swf,"
    "caparao.swf,"
    "cedro.swf,"
    "cesama.swf,"
    "copasa.swf,"
    "damatta.swf,"
    "emtel.swf,"
    "engedrain.swf,"
    "extel.swf,"
    "feedback.swf,"
    "iti.swf,"
    "intermedium.swf,"
    "magnesita.swf,"
    "maquenge.swf,"
    "maxxdata.swf,"
    "orteng.swf,"
    "paiva.swf,"
    "paraibuna.swf,"
    "paraopeba.swf,"
    "sabesp.swf,"
    "serpro.swf,"
    "soll.swf,"
    'thawte.swf '.
    );

    function executeCallback(param:String) {}
    var duration: number = 5000;
    loadMovie (banners [count], loadmovie_mc);
    loadmovie_mc._x = 0;
    loadmovie_mc._y = 0;

    clearInterval (intervalId);
    if(Count < maxCount) {}
    Count ++;
    intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);
    }
    else {}
    Count = 0;
    intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);
    }
    }

    If (intervalId! = null) {}
    clearInterval (intervalId);
    }

    intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);

    end of the code
    ----------------------------------------

    And the code to the preloader (this code I place in the movieclip that loads external SWF files):

    start of the code:

    {onClipEvent (enterFrame)}
    var gtT:Number = this.getBytesTotal ();
    var gtL:Number = this.getBytesLoaded ();
    var gtP:Number = int ((gtL/gtT) * 100);
    If (TWG > gtL) {}
    This ._alpha = 0;
    _root. Loader._alpha = 100;
    _root. Loader.bar._width = gtP;
    clearInterval (intervalId);
    } else {}
    This ._alpha = 100;
    _root. Loader._alpha = 0;
    intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);
    delete onEnterFrame;
    }
    }

    end of the code

    Note that I tried to freeze the time using a clearInterval does in the second code, but he simply doesn't work...

    Any ideas? Thank you

    Edson

    Here's the correct code kglad send me. Thank you very much!

  • Preloader is running on top of the external SWF

    I have a very simple preloader that loads an external SWF. It almost works. :-)

    I find that the external SWF appears in the window - good - but the preloader continues to run on top of it - bad. I have attached the actionscript code that is in my preloader...

    To see it in action, go HERE.

    Thanks in advance!
    -bryan

    ================================================

    Thank you very much. But I think that I'm not sure why the progress bar is HERE. If the SWF file is loaded and appears in the window, why is the progress bar still there and running? Why didn't he go away? The progress bar is correct, and the SWF file is displayed even if it is only partially charged?

    I finally subordinate the visibility of the external SWF that it is fully charged - so bytesLoaded file< bytestotal,="" then="" the="" swf's="" visibility="" is="" set="" to="" false.="" maybe="" that's="" just="" kludge,="" but="" it="">

    Again, thank you for answering my question!

  • Stop the sound from the external SWF

    Here's my problem. I have a main.swf and I load an external audio player.swf. I need to stop the player.swf sound when I press a button on the main.swf. Not all the buttons just a few buttons. I have now, I have to put the code in each button. Thank you

    have you tried stopAllSounds()

  • Play an external .swf sound loaded

    I have a small .swf file containing any of the characters in my game. In my project main actionscript 3, I load the .swf from an external source and display it in my game. It works very well, however, I join the swf file contains a short sound clip that should be played whenever the user clicks on the character.

    I know that I could add an onClick listener to the small .swf itself and write code in Flash Professional to play the sound. The problem is that I have an options menu in my game that allows the user to specify the volume of these sounds, and I think that this information would be unavailable for the loaded external .swf

    The audio file must therefore somehow be packed inside the .swf of character, but I also need to be able to play through my custom "SoundPlayer" class that I have in my actionscript project. Any ideas how I could do this?

    create a public method in your external swf file that controls the volume of the sounds.

  • Stop an external SWF to play

    OK I'm pretty new to this AS 3.0.

    I'm going to make my portfolio site.

    I'm loading external swf in my my navigation page that contains most of my pieces of content for the home page.
    I loaded in my head and it has some animation on it since the time line.
    So it loads fine and plays through animation, but then it loops again and I want to just play once and stop.

    Is there a code I can write to him to play once?
    It is not a clip in the SWF file, it's just a text I have moving across the screen in a simple motion tween.
    I was looking through my bible AS3.0 and he mentions being able to stop a clip by means another call onEnterFrame combined with goToAndPlay() and stop() even.

    But they do not explain it and I'm lost; They show any example of code.
    I would like to convert it to a clip, or is there a way to stop it the way I have it.
    Please be detailed in any explanation provide you and use simple terms, I'm still learning this AS code.

    Thanks in advance!

    Are these Flash animations that you have created? If you have access to your external SWFs FLA files, you must still add a stop(); command at the end of the animation to prevent exactly this problem (which is a problem for all versions of Flash, not AS3). Without a stop(); command, the Flash file will make a loop when it reaches the last frame of the timeline.

    But perhaps you have a different problem than that...

  • MainTimelime ContextMenuItem MENU_ITEM_SELECT event not sent the magazine containing the external SWF

    1. custom context menu applied to MainTimeline
    2. using a Loader() to load an external SWF and have it added to its container display string
    3. Make a right-click SWF loaded menu contextual custom appears, but the MENU_ITEM_SELECT events are not dispatched when the user clicks on the items
    4. click right on elsewhere in the parent SWF works great, even on deep nested objects (not externally loaded)
    5. Remove loaded SWF of the display string and right clicking in its location very good

    I managed to find a hack . On the charger () parent display object, I put:

    .mouseEnabled = false;

  • How to make reference to the external SWF file using if statement?

    I have a main swf file that loads several external SWF file when the user clicks a menu button. Now I want to target a specific swf file to Add an extra library child or of another swf when this specific swf file is loaded. How should I do? What should I put in the stated case?

    ///////////////////////////////////////////////////////////

    var newswf:URLRequest = new URLRequest (".") ("/ swf /" + event.target.name + ".swf");

    Loader.Load (newswf);

    addChild (loader); dynamically load SWFs

    If (newswf == ".") ("/ SWF/pubResCHETNA.swf ') //error here

    {

    FC.buttonMode = true;

    FC.addEventListener (MouseEvent.CLICK, full screen);

    }

    function fullScreen(e:MouseEvent):void

    {

    var loaderF:Loader = new Loader();

    loaderF.load (new URLRequest ("PopupFullscreen.swf"));

    addChild (loaderF);

    }

    ////////////////////////////////////////////////////////

    The State must be newswf.url == the path. However I store event.target.name as a variable and use it in the State. You use "." for your path so the condition probably will always fail.

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.UK/

  • How to unload the external .swf file when pass the other section?

    Hello

    The following code provided by Mr. kglad works very well to load an external .swf file on stage. Now, when I click on Contact (button), the file external .swf to disappear completely. How to encode on contact (button) to get by.

    Gallery.addEventListener (MouseEvent.CLICK, GalleryClick);

    function GalleryClick(e:Event):void {}

    If (currentClip! = Gallery_mc) {}

    currentClip.visible = false;

    Gallery_mc. Visible = true;

    currentClip = Gallery_mc ;}

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, ClipLoaded);

    Loader.Load (new URLRequest ("Gallery.swf"));

    function ClipLoaded(e:Event):void {}

    Gallery_mc. AddChild (Loader);

    Loader.x = 0;

    Loader.y = 120;

    Loader.Width = 1000;

    Loader.Height = 700

    }}

    I tried the following code for Contact_btn unload the Gallery.swf file that launches an error message: 1120: access of undefined property loader.

    Contact.addEventListener (MouseEvent.CLICK, ContactClick);

    function ContactClick(e:Event):void {}

    If (currentClip! = Cotnact_mc) {}

    currentClip.visible = false;

    Cotnact_mc. Visible = true;

    currentClip = Cotnact_mc;

    Gallery_mc.removeChild (loader);}}

    unloadAndStop() is supported by flash player 10 or higher (fp 10 +).

    p.s. Please check the useful/correct, if there is.

  • How to resize the external .swf files?

    Hello

    THA following the code is to resize the video Clips which are on stage. But how can I resize externally. SWF files? I am adding an external .swf file through Gallery_mc.addChild (loader);

    The following code works very well for resizing of video Clips on stage:

    var myStage:Stage = this.stage;

    myStage.scaleMode = StageScaleMode.NO_SCALE;

    myStage.align = StageAlign.TOP_LEFT;

    function initialDisplay(event:Event):void {}

    var swfWidth:int = myStage.stageWidth;

    var swfHeight:int = myStage.stageHeight;

    Gallery_mc. Width = swfWidth;

    Gallery_mc. Height = swfHeight ;}

    addEventListener (Event:ENTER_FRAME, initialDisplay);

    Help, please.

    Thank you.

    It is not supposed to resize an external swf, unless you load it.  If you load, use a complete listener to resize:

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, f);

    Loader.Load (new URLRequest ("swf1.swf"));

    function f(e:Event):void {}

    addChild (loader);

    Loader.Width = Whatever;

    etc.

    }

Maybe you are looking for

  • Add on elegant does not

    A few months ago, I installed elegant and it has worked perfectly for a while - and then one day it just stopped. Nothing works. I checked to see if Firefox has updated - nope. I deactivated and reactivated the add-on - nope. I uninstalled and reinst

  • Problem DVD player in Portege R500 running Win XP Pro

    I have spent in my new r500 to Win XP Pro using the recovery CD of original product provided with the noteboook. Then I discovered that I can't see my computer's DVD drive. In device drivers, a problem is seen on USB Mass Storage Device Driver with s

  • Lenses &amp; lens adapters

    I think it would be a good idea to publish information about what lens and lens adapters we use including images,. There are so many combinations available, it would be very helpful to new people in the industry like me to have available what works w

  • Want to 4500. All-in-one: my printer indicates it does not support the paper photo paper 4 x 6

    My printer says it doesn't support of paper smaller than 4.9 / 12.6. I am trying to print a photo on photo paper glossy 4 x 6.

  • PC6248p - xg ports

    I have two PC6248 stacked switches.  Switch 1 has also a SPF module +.   These ports XG 1 and XG2 or are they XG3 XG4.  I didn't know if the ports on the module stacking to slot 1 are considered XG1 & 2 or not. Please notify.  Thank you.