Playing a mp3 when a movie clip loads

I am using Adobe Flash Professional CS6
What I am trying to do is play a mp3 file that I have in my library when the clip loads and stop playing it when the a new clip is selected from the menu I created.  On the button that loads the movie clip (Instance name: Slideshow), I have the following code:
[code]
on (release){
    gotoAndPlay(120);
onClipEvent (load){
    mySong = new Sound();
    mySong.attachSound("MastersThisHall");
    mySong.start(0,50);
onClipEvent (unload) {
    mySong.stop();
[/code]
- I went to the properties of the MastersThisHall.mp3 file in my library,
- Selected the "ActionScript", tab,
- Checked the box that says "Export for ActionScript",
- Unchecked the "Export in frame 1" check box, and
- Added MastersThisHall in the "Identifier" field.
The sound is NOT playing when I when the "Slideshow" button is pressed.
Ideas?

Thank you for all of this; it is very helpful.
I have series of 6 buttons I created, each of them load a different movie clip. I need to have the music from the slideshow NOT continue to play when a new movie clip is selected.
I have the following code.
Frame 1:
SlideshowMusic = new Sound(this);
SlideshowMusic.attachSound("MastersThisHall");
stop();
Frame 120 (attached to the Slideshow movie clip object):
onClipEvent (load) {
    SlideshowMusic.play();
The "Mute" Button:
on (release) {
    SlideshowMusic.setVolume(0);
The "Resume Sound" Button:
on (release) {
     SlideshowMusic.setVolume(100);
And the "Pause" Button:
on (release)
  if (SlideshowMusic.position < SlideshowMusic.duration)
    SlideshowMusic.start(SlideshowMusic.position / 1000);
It is loading and working perfectly. However, I have two more questions:
1. How do I make the the sound automatically stop when a new movie clip is played?
2. How do I change the "pause" symbol to the "play" symbol when the "Pause" button is pressed?

Similar Messages

  • Using Flach CS4 and action script 2.0 how do I advance to a specific frame of the main timeline when a movie clip instance come to the end of its timeline?

    Using Flach CS4 and action script 2.0 how do I advance to a specific frame of the main timeline when a movie clip instance come to the end of its timeline?

    code on the last frame of your movieclip instance:
    _root.gotoAndStop('whatever_frame');  // will work unless this swf is loaded into another swf.  in that situation, you should use a relative path to the main timeline (eg,  _parent or _parent._parent etc).

  • How to detect when 2 movie clips have been clicked?

    Hello:
    I'd like to know how can I detect when 2 movie clips have been clicked (irregardles of the order).
    What I have is this:
    In my main timeline I have 2 independent movie clips (mc_him and mc_her) each in it's own layer that, when clicked, play an internal animation without moving my main playhead anywhere. What I need to do is, once they are both clicked (as I said, it doesen't matter in what order), a button that sends me to another section of my movie has to appear. It really doesen't matter if the button shows by enabling it with alpha or by sending me to a specific frame where my button lies. What I need to detect is both clicks so that the button shows up.
    How can I achieve this?
    Thank you very much.

    btn1.onRelease=function(){
    // do whatever
    this.clicked = true;
    checkBothClickedF();
    btn2.onRelease=function(){
    // do whatever
    this.clicked = true;
    checkBothClickedF();
    function checkBothClickedF():Void{
    if(btn1.clicked&&btn2.clicked){
    // do something. both clicked
    // reset both clicked properties?

  • FPS drop when using movie clips.

    Hello, first of all excuse my English it's not my main
    language.
    I'm working with a portfolio in Flash CS4 (actionscript 2.0
    if that would matter). The portfolio has buttons, each button is
    connected to a movie clip, so when you press the button a movie
    clip starts playing (It's in the background all the time though
    alpha is at 0%). The movie clip contains another two movie clips,
    both of those goes from 0% alpha, to 100% alpha and then back to 0%
    alpha. There is also a button on top of the two movie clips. So all
    and all it's a movie clip containing two other movie clips and one
    button.
    Anyway, when I have about 3 buttons and movie clips there is
    no problem, but when I add 4-5 or more the FPS get's very low when
    the movie clip plays.
    I have tried to change the FPS from 25 to 40 etc. but there
    is no change. I have also tried Flash Player 9 and 10.
    I don't think the problem is my computer, since I've exported
    it as a movie and tried on friends computers.
    Thanks in advance.

    It depends what is in your movie clips, and how much is
    happening during the alpha transitions. The playback speed depends
    on how much work the processor has to do. If you have a lot of
    large elements - for example, photos that you resized in Flash -
    moving around, changing alpha, all at the same time, it will slow
    down performance.
    Try to simplify your graphics. So, if you are using bitmap
    images, resize them before importing them to Flash. Then try
    removing some of your graphics and see if it speeds up performance.
    This will help you to locate the problem.

  • Automatically play a mp3 when usb flash drive is plugged in

    Is there any way to Automatically play a mp3 when usb flash drive is plugged in ? using automator or apple script
    Message was edited by: Flame_Macbook

    Could be. Search the AppleScript forum under OS X Technologies. For Automator stuff, start with http://discussions.apple.com/thread.jspa?threadID=2039384 and Introduction to Automator tutorial at http://automator.us/leopard/video/index.html
    And, http://www.automatedworkflows.com/tips/podcast.html and
    http://www.macosxautomation.com/automator/examples/ex04/index.html

  • How do I separate short movie clips loaded from my digital camera to iPhoto 11 at the same time pics are downloaded and how do I get those video clips to a dvd that will play on a dvd player

    When loading pics to iphoto 11 from my camera, occassionaly it will include some video clips with the description of Movxxxx. I wonder if someone could direct me to some straight forward instructions as to how to transfer these video (movie) clips, which now exist in iphoto, to a dvd that will play on a dvd player as one might  expect to see a video play, including the audio that was captured at the time of filming.
    Thanks in advance for any assistance you can offer this novice.

    You need to open iMovie and it will have a event library called iPhoto Videos, click on that and the videos will load in the window next to it, then you make a new project in iMovie.  Then open iDVD and make a new project then import the movies to the program then burn to a DVD..

  • Question about scrolling and Movie Clips Loaded from the Library

    I hope I am posting this in the right forum.
    Ok, I'm using actionscript 2.0, and I am trying to make a scrolling image gallery. I have a movie clip with three layers. the first contains a movie clip used as a scroll bar. The second is a mask used to hide the overflow content, and the third contains movie clip thumbnails. when I click one of the thumbnails, it loads a symbol containing a larger version of the picture over top of the thumbnails on the same layer. My problem is, the large image is added at the very top of the movie clip, even when it is scrolled out of sight. I want it to appear in sight, so the user doesn't have to scroll all the way back up to the top to see it. This is annoying and confusing. Is there a way to do this?
    Here is the code I used to create the scroll effect (there is actually a whole lot more to the code but it is very long, so I am not adding it now. I will if it is needed though) 
    (Oh, and there is no text involved in this. I just got this code off a tutorial and I haven't changed the variable names yet)
        var scrollUpper:Number = 58;
        var scrollLower:Number = 309;
        var textLower:Number = 60;
        var textUpper:Number = -179;
        var scrollRange:Number = scrollLower - scrollUpper;
        var textRange:Number = textLower - textUpper;
        var startY:Number = imagesHolder_mc.thumbs_mc._y;
        function scroll(){
           var moved:Number = imagesHolder_mc.scroller_mc._y - scrollUpper;
           var pctMoved:Number = moved/scrollRange;
           var textMove:Number = pctMoved*textRange;
           imagesHolder_mc.thumbs_mc._y = textLower - textMove;
        imagesHolder_mc.scroller_mc.onPress = function(){
           this.startDrag(false,this._x,scrollUpper,this._x,scrollLower);
           this.onMouseMove = scroll;
        imagesHolder_mc.scroller_mc.onRelease = scroller_mc.onReleaseOutside = function(){
           this.stopDrag();
           this.onMouseMove = null}

    Thanks for your reply. I'll try to explain it better. I have a long, vertically scrolling movie clip. This movie clip contains lots of thumbnails. When I click a thumbnail, the full sized image is loaded from the library and displayed within the same movie clip. when I click the full size movie clip, it disappears again, and I can click another thumbnail to display another full size image. So I'm not just adding more and more stuff to the gallery if that's what you were thinking. I'm just clicking thumbnails to display the full size image so I can look at it, closing it, and moving on.
    But the full sized image is fixed at the very top of the scrolling movie clip, so if I click a thumbnail at the very bottom, I have to scroll all the way back up to the top to see the full size image. I just want the full size image to appear on screen no matter how far down I have scrolled to click a thumbnail.
    I made my basic gallery useing this tutorial:
    http://flashexplained.com/actionscript/making-the-ultimate-dynamic-image-gallery-in-flash- 8/
    if you want to take a look at that, to get an idea of what I'm talking about.
    Now I'm just trying to add some scrolling functionality, which wasn't included, but I don't really understand actionscript well enough to do this easily on my own.
    Sorry for the long reply. I hope this is clearer.

  • Mask - movie clip loaded from .swf

    Hi!
    I have made an application where a movie clip (map_mc) is
    masked by another movie_clip (map_window_mc:
    map_mc.setMask("map_window_mc");
    This works fine until I try to load an "external" .swf into
    map_mc:
    map_mc.loadMovie("Testmap.swf");
    Then the mask does not work anymore......
    Any suggestions?
    (The testmap.swf is also displaced from map_mc.........)
    I use Flash 2004 MX pro
    terjem

    terjem,
    > My problem is probably that I really don't know wath
    event
    > handler I should use...
    Depending on the approach you're using, there may not even
    be an event
    handler when the external SWF loads. If you're using the
    MovieClipLoader
    class, there will be. If you're using a
    MovieClip.onEnterFrame loop, there
    won't be.
    > Here is the first ("non-automatic") code that works:
    Okay.
    > map_mc.loadMovie("Testmap.swf");
    > trace("Loading started!");
    > this.onEnterFrame = function() {
    > if (
    > map_mc.getBytesLoaded() > 0 &&
    > map_mc.getBytesLoaded() >= map_mc.getBytesTotal()
    > ) {
    > trace("Loading complete!");
    > trace("File width: " + map_mc._width);
    > delete this.onEnterFrame;
    > } else {
    > trace("File width: " + map_mc._width);
    > }
    > };
    Okay. So far, so good. When bytes loaded is greater than
    zero and
    greater than or equal to bytes total, you'll know the
    external SWF has fully
    loaded. You'll know, because the "Loading complete!" trace
    will be visible
    in your Output panel. Well, that means the place in this
    script that
    represents "where to put additional code" is right were your
    trace()
    functions are. Not in the "else" clause, but the first one
    this.onEnterFrame = function() {
    if (
    map_mc.getBytesLoaded() > 0 &&
    map_mc.getBytesLoaded() >= map_mc.getBytesTotal()
    trace("Loading complete!");
    trace("File width: " + map_mc._width);
    [delete these trace() functions, if you like]
    [add your masking code here]
    delete this.onEnterFrame;
    // etc.
    > The code below does not work (the positioning of the
    > map_mc works, but not the setMask):
    Your problem may be right here ...
    > map_mc.setMask("map_window_mc");
    ... because "map_window_mc" is in quotes. Yes, the
    ActionScript Language
    Reference says the parameter of setMask() may be a string,
    but leave the
    quotes out and see what happens. In any case,
    David
    stiller (at) quip (dot) net
    Dev essays:
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • How to make the background move over when a movie clip hits the edge

    ok so the idea here is to make a page with written content on it. the conent will not be able to be seen unless the user hits the arrow keys on there key board. So i need to make a group of objects i can make into a movie clip and than inside that movie clip make an animation that plays the squirrel running. i will pause here to ask two things i dont know how to do i want the squirrel to have an animation when standing still where it flicks its tail (like a real squirrel would). and also how would i flip the squirrel so when the left key is pressed it points left and when the right arrow is pressed it faces left? and my main question when it reaches the edge of the stage the extended background that runs off stage moves over to reavel more content. as well as not have the squirrel run off stage? in short i am using the squirrel to view the full pages content.

    You're asking for quite a bit and aren't likely to get anyone to hand you a detailed solution.  Here's some things to think about.
    As far as flicking the tail goes, that's something you'll have to work out as an animation.  You could do it as a timeline animation and/or as a coded animation where you adjust the rotation and other properties of the tail.
    Getting the object to face left and right ican be a simple matter of changing its xscale property from 1 to -1 depending on which way it normally faces (1).
    If you don't have a problem making the squirrel move to the edge, then you should have no problem making the background move either.  You just need to continually check the squirrel x property to know when it hits the edge.  Personally, I would only move the background and leave the squirrel in the center.

  • Sync movie clips loaded by swfloader

    hi guys,
    i have 5 separate movie clips (swf) represent 5 flower petals,
    each of them is showing up from center,
    i load them in flex app by 5 separate mx:SWFLoader tags.
    the problem is they should sync with each other to open up the flower,
    but due to being loaded from network, they don't start at the same time.
    please help me, how to sync these flower petals?

    according to http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/SWFLoader.h tml
    it doesn't seem like SWFLoader has a method called "rewind()" or "gotoAndPlay(...)"?

  • Premiere CS6 crashing when I move clips in the timeline

    This error box appears when I try to move things around in the timeline. I'm not exactly sure where to start so I don't know what to troubleshoot.
    Anyone ever get this before?

    Yes!  I too keep trying to move clips and get relentless crashing.  My clips are all named.  I also tried to rename a clip and when I moved it, CS6 crashed just like before.  Is there another clip name you are referring to?

  • Movie Clip loading buttons require double clicking on the first attempt

    I have created a number of buttons that load move clips into
    an empty movie clip. The problem is that it takes several clicks to
    activate the first clip button then the buttons behave as they are
    supposed to and load properly. Is there a reason why the first time
    you must click several times to activate the button loading a movie
    clip?

    stop();
    unloadMovie(1);
    agatha_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("agatha_full.swf", 1);
    anastasia_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("anastasia_full.swf", 1);
    chiara_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("chiara_full.swf", 1);
    clarisse_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("clarisse_full.swf", 1);
    fifi_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("fifi_full.swf", 1);
    gigi_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("gigi_full.swf", 1);
    ginger_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("ginger_full.swf", 1);
    ingrid_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("ingrid_full.swf", 1);
    lucrezia_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("lucrezia_full.swf", 1);
    natasha_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("natasha_full.swf", 1);
    philipa_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("philipa_full.swf", 1);
    signy_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("signy_full.swf", 1);
    sophia_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("sophia_full.swf", 1);
    teresa_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("teresa_full.swf", 1);
    trudi_btn.onRelease = function() {
    nextFrame();
    loadMovieNum("trudi_full.swf", 1);
    };

  • Condition-when 2 movie clips touch

    hi everyone
    i want to make a condition which happend if one movie clip
    touches another one.
    i meen specific movie clips.
    if (a touches b)
    i thought of (when a passes the _x fo b, and the same for the
    _y, but that would wwork only if its a squar or a rectangle
    where the _y and _x are the objects limits, but otherwise, it
    won't work
    don't hurry to answer and if you have something more fun or
    important to do, do it.
    i can wait

    that will work for mine too! mine are only circles that I
    wanted to make touch.

  • I know this can't be the right code to play on mp3 in flash movie

    I just feel that this is not the right code to playing sound if actionscript 3. I'm trying to play a mp3 sound only in flash can someone tell what is the right script to use. This is what I' m using.
    stop();
    play_btn.addEventListener(MouseEvent.CLICK, playSound);
    goback_btn.addEventListener(MouseEvent.onRelease, goSound);
    stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
    function playSound(e:MouseEvent):void {
        this.play();
    function goSound(e:MouseEvent):void {
        this.gotoAndPlay("1");
    function stopSound(e:MouseEvent):void {
        this.stop();
    thanks

    it's in my library
    I figured out how to write code for mp3 to play
    Now I can't write one to make it stop or gotoAndPlay.
    This is my code to play
    play_btn.addEventListener(MouseEvent.CLICK, playMusic);
    function playMusic(e:MouseEvent):void {
        var myMusic:Sound = new Sound();
        var soundFile:URLRequest = new URLRequest("custodiansofkingdom.mp3");
        myMusic.load(soundFile);
        myMusic.play();
    Can someone tell me how to write code to make it stop and gotoAndPlay
    Thanks

  • Why does pprocs6 crash when i move clips in timeline??? [ error: ... linkcontainer.cpp-245 ]

    I am currently editing a short film which is only about 25-30mins long with nothing out of the ordinary in the timeline. There are a couple of nested sequences but most of it is .MTS (AVCHD from Sony NEX VG20) and .WAV files for audio (inc some 5.1 audio from camera).
    Some of the channels are locked so they dont move but other than that nothing strange or particualry intensive is being done. Some of the clips are 25fps and some are 60fps but this shouldnt be a proplem for PProCS6!
    The sequence settings are AVCHD 720, 24fps,
    I am running a core2duo 2.16cpu/8gbram/ creative cloud OS and program on C: drive, footage on esata G: drive and scratch drive O: drive is another usb 2.0 drive.
    As soon as I move the clips in the timeline as a group I get this error come up (see screengrabs below) "... linkcontainer.cpp-245"
    please help
    None of my searches have given me an answer, one person even said "reinstall software" [nonesense!!!]
    I am just days away from submitting my short film for my final major project at Uni and the film is worth 50% of my module... basically I could fail if film isnt handed in!

    The CPU hasnt been too much of an issue before, I shot a 1hr30min documentary last year at it only lagged at the final export stage.
    In saying that it isnt the best, thank God my upgrade is coming soon!
    What I mean by "moving the clips in a group is..."
    using the tool (right facing arrow and shift - sorry I cant remember the tool's name) and selecting every clip to the right of it, for the purposes of moving to an earlier point in the timeline to close a gap, moving clips individually is out of the question and there are too many and loads are specifically sync'd and have intricate sequencing and timings.
    I havent tried 'grouping' the clips but I shouldnt need to for a simple move like this.
    All I need to do is close a few gaps in the timeline.
    thanks
    Allan

Maybe you are looking for