Load and play different external MP3

I wanted to do something that I thought was simple - I wanted to have a read of the sound (external mp3 loaded) and have then different buttons on the screen that are responsible for another song instead.  Could someone help me please?

That's what I'm doing:

var myMusic:Sound = new Sound();
var reqMyMusic:URLRequest = new URLRequest ("mySong.mp3");
myMusic.load (reqMyMusic);
myMusic.play ();

music1_btn.addEventListener (MouseEvent.CLICK, music1);

music2_btn.addEventListener (MouseEvent.CLICK, music2);

function music1(event:Event)
{
LOAD AND PLAY A DIFFERENT MP3 (instead of mySong.mp3)
}

function music2(event:Event)

{

LOAD AND PLAY A DIFFERENT MP3 (instead of mySong.mp3)

}

use:

var myMusic:Sound = new Sound();
var reqMyMusic:URLRequest = new URLRequest ("mySong.mp3");
myMusic.load (reqMyMusic);
var sc:SoundChannel = myMusic.play ();

music1_btn.addEventListener (MouseEvent.CLICK, music1);

music2_btn.addEventListener (MouseEvent.CLICK, music2);

function music1(event:Event)
{
SC. Stop();

myMusic = null;

myMusic = newSound ();

myMusic.load (new URLRequest ("whatever"));

SC = myMusic.Play ();

}

function music2(event:Event)

{

SC. Stop();

myMusic = null;

myMusic = newSound ();

myMusic.load (new URLRequest ("whatever"));

SC = myMusic.Play ();

}

Tags: Adobe Animate

Similar Questions

  • With the help of a button to load and unload the external SWF in AS3?

    How can I use a button to load and unload a sequence of external SWF files, as a Next button and previous?

    I don't know if it will work because apparently you are trying to load a swf AS1/2, but try

    change the line to be...

    _swfTempClip = MovieClip (event.target.content);

    If this does not work, then you will need to create _swfTempClip as a new MovieClip and add the event.target.content to this MovieClip using addChild().

  • The video is slow to load and play

    When I try to play a video or music, it does not play correctly, it is time really slow or just guard stop and start

    What I tell you so that you can help me I also have Windows XP 9.0.

    My PC was playing very well week last of videos and films, but even not more megavideo has become pretty darn slow I could go on for an hour and it does not load so slightly. What I did wrong in my internet options, or the deletion of cookies. How can I solve this... PLEASE SOMEONE HELP ME BEFORE I LITERALLY BROKE MY PC... And I don't want to do that... but I get frustrated and very PISSED OFF in MY PC... WHEN I chose the wrong settings for my AVG?

    JUST FOUND THIS AND HIS WORK AS HE WENT OUT THE BOOX...

    1. CLICK ON START

    2 CONTROL PANEL

    3. INTERNET OPTIONS

    4 ADVANCED

    5. ON THE BOTTOM OF THE SUCCESS PAGE RESET

    THIS WILL RESET ALL YOUR INTERNET SETTINGS...  AND IT WORKED...

  • Netflix instant movies will load and play on my computer, stuck at "loading".

    I have a HP TouchSmart300 PC with the Windows 7 operating system.  Recently I can not access my Netflix instant movies.  Can I purchase my movies, but when I select a movie to play, it scrolls "loading".  All movies doesn't load, same result, 'loading '.  I saw last successfully a film 23/04/11.  I got to 31/03/11 with no luck.  I don't know which driver executes the program.  Any help would be appreciated.  Thank you.

    Hello

    I suggest you install the latest version of Microsoft Silverlight and check if it helps:

    http://www.Microsoft.com/Silverlight/

    Also try to uninstall any previous version of Silverlight before installing the new.

    Hope this helps,

  • My Flash Player stops loading and playing to halfway through - Help!

    Hello

    On my browsers Chrome AND Firefox for Windows 10 (installed on Chrome 21,0,0,216 flash drive) whenever I have a video in particular, the buffer or loading happens to halfway across before it goes to the end and then the video plays only to halfway.

    I tried

    -Cleared my cache of web browsers and history

    -Removal of all websites in Flash Player storage settings panel

    -Restarted my computer / browser / modem.

    -Uninstall and reinstall flash

    -Tried to increase global storage settings (will not save)

    -Contacted the video website and they confirmed there is no problem on the end here and to rub salt on the wound has sent a screenshot of the video beyond 50%

    -The website even gave me another connection to try but it still doesn't work

    I would be appreciated from anyone to help, thanks in advance and good luck.

    I think that you posted your question in the wrong forum. Please click on FlashHelp crumbs above this post and see the sticky "this forum is NOT for Adobe Flash and Adobe Flash Player problems. There is a link to the correct forum.

    See www.grainge.org for RoboHelp and Authoring information

    @petergrainge

  • Need HELP loading and unloading SWFs external when the user clicks on the buttons

    Hi everyone, I'm working on a few Web sites at the moment, one for being my online portfolio, as well as my Web site for a product of sleep, that I'm selling.  I have very little experience with AS3, last time I created a Web site that as2 has been used.  I tried a few tutorials online, but nothing performs the work, there is always an error...

    I have an index.swf that loads the default home.swf.   There is also an about.swf, contact.swf, order.swf and testimonials.swf...

    It was a hair pulling 4 days now, not be able to get this working.

    All I need is for the swf external to pull up when you click on the corresponding button, and when the next button is clicked, the current to unload swf and swf to load new file.  It was so simple with AS2, you would think things could be as easy, if not easier.   So any help that all the world can offer, I would be so very you happy for me!  If necessary I can copy my current code, even if it doesn't work!   Thanks, Mike

    var loader: Loader = new Loader();

    addChild (loader);

    home_btn.addEventListener (MouseEvent.Click, loadF);

    about_btn.addEventListener (MouseEvent.Click, loadF);

    contact_btn.addEventListener (MouseEvent.Click, loadF);

    function loadF(e:Event):void {}

    Loader.Load (new URLRequest (e.currentTarget.name.split ("_") [0] + ".swf")); / / assuming that each reference button is also the button's name property

    }

  • Go to the next image after movie loads and plays

    To all,

    I try to get my file from master.swf to load a separate film called 'splash.swf' to play at the end of the film "splash.swf" then go to the next section and load the next movie called "home.swf".

    what I have so far:

    Stop();
    dyMCL.loadClip ("splash.swf", 5);

    * what I need *.

    If (condition) {}
    gotoAndPlay (3)
    };

    Any thoughts?


    Thank you

    Kyle

    OK, so that work very well! I made a few changes, but everything works. Thanks for your help!

    dyMCL.addListener (this);
    dyMCL.loadClip ("splash.swf", 5);
    function onLoadInit(mc:MovieClip) {}
    dyMCL.removeListener (dyMCL);
    checkFrames (mc);
    }
    function checkFrames(mc:MovieClip) {}
    mc.onEnterFrame = function() {}
    If (this ._currentframe = this ._totalframes) {}
    _root.gotoAndStop (3);
    load home.swf
    delete this.onEnterFrame;
    }
    };
    }

  • loaded and played football manager 2010, but used now run on my games page, but does not

    downloaded and then played for a few hours of game save, but when I got to play this new game clicked inserted disc but no response

    Hi batty64,

    (a) do you get an error message when you insert the disc?

    Insert the disc in another computer and check to make sure there is no problem with the disk.

    (b) is any change happened to your computer after you have saved the game?

    You can also try the System Restore and see if it helps

    Access the link.

    What is system restore?
    http://Windows.Microsoft.com/en-us/Windows7/what-is-system-restore

    You can also post your question here: http://www.footballmanager.com/

    Or try to contact the game manufacturer

    Aziz Nadeem - Microsoft Support

  • Loading and playing of music also works on Fuze & Ubuntu 8.10 - Possible with Win XP?

    With the MTP USB Mode selected:

    (a) Ubuntu 8.10 and Rhythmbox after clicking on eject the device (Sansa Fuze) he continues to collect, but as if I would use a wall charger I can listen to music.

    (b) with Windows XP SP in Songbird 1.1.1 it does not. Is there a way to do the same thing with Rhythmbox?

    (clicking on safely eject hardware in windows keeps also the "rocket" does not).

    If this is possible under Linux it should be possible under XP also. Someone at - he found?

    There is a way to do it, but it is more "manual".

    Pull out the USB port on the computer after having ejected, then reinsert it, but do not push down.  It stir slowly until the battery begins to load, but making contacts in the USB cable before contact with the computer contacts data.  I often use this method successfully.

  • cannot configure the plug-in and play micro external usb,.

    I think I need to download the software, but don't know how to download the software or where to find the software I need, can any one help thank you.

    Hello

    Please activate the external microphone, then try again (for Windows):

    Right click on the speaker icon,

    Select record devives

    Right click and activate

    Kind regards.

  • Is there a way to get the Audio to load and play automatically when the user turns the page?

    I am creating a musical application and I would like a sample of the audio play when the user opens a page. I use Indesign CC and building an app for iOS. I didn't know the function that allows me to do this? If anyone knows the answer, I would be very grateful.

    Thank you

    If you use DPS you can add the audio file in the Panel inlays Folio select Audio/video and enable automatic playback.

    See our help section at http://helpx.adobe.com/digital-publishing-suite/help/audio-video-overlays.html for more information.

    Neil

  • Most sites work OK, YouTube loads and plays videos, if I try the connection that the page does not load, and all I get is a page of random characters?

    The above doesn't happen if you use Firefox and not other browsers?

    You can check the preferences of network.http. * on the subject: config page and delivery to zero all users "BOLD" network.http set prefs by default via the context menu-> reset.

    Check at least:

    • Network.http.Accept - Encoding (default: gzip, deflate)
  • Computer crashes constantly and now videos take forever to load and play.

    When I look at where they come from, my computer hangs like a madman and half the time, I just videos, case is not giving up the video.  My computer freezes constantly, and yet everything is updated and functioning.  I could be reading a news article and all of a sudden the whole system goes black and white and then after about 30 seconds the computer turns off.  I cleaned it with canned air and everything recommended.  Can I go back to Windows 8 and abandon 8.1?  I need assistance with these issues and in other words please.  Why this keep happening?  What are the viable alternatives are there for all these problems?  Nothing started happening until my computer updated automatically with 8.1 and now has been a year of nightmares constantly.  Help, please.

    Helpless and needs fixing

    I'm no expert, but I think that there is a problem with the Windows updates for 8.1 and HP desktop computers, dragged my mouse, its has been staticy with snoring and crackling and video would freeze intermittently. What finally fixed my machine was a complete restoration and blocking the windows updates. Now my machine is perfect except for the fact that the heartbeat sounds terrible. The beats are working fine now, they sound just terrible.

  • Xbox one load and play light kit not or white

    When I plug my charging cable it charges the battery but the orange and white lights do not shine. I did a hard reset and made sure its plugged in properly. What can I do more? Or how to fix it?

    Hello

    Your Question is beyond the scope of this community...

    I suggest that repost you in the Xbox Forums.

    "Xbox a Preview program FAQ.

    http://support.Xbox.com/en-us/Xbox-one/system/Xbox-update-preview-FAQ

    'Home'

    http://forums.Xbox.com/

    "Xbox forums.

    http://forums.Xbox.com/xbox_forums/general_discussion/f/3817.aspx

    _________________________________________________

    "Xbox Forums directory.

    http://www.Xbox.com/en-us/forums

    General

    Material & Discussion Services

    Xbox support
    Agent hours: M - F 09:00-17:00 PT

    Law enforcement forums

    Technical support of Xbox Live rewards
    Xbox Live rewards Squad hours: M - F 09:00-17: 00 PST

    See you soon.

  • Can't seem to load and listen to music at the same time

    So I got my Droid X for a week now. A great phone. But I'm having a problem. Basically, I want to listen to music while it is connected to a computer via a USB cable to charge. "' Charge mode I guess put the phone in" only "would set the phone to use only the USB cable for power and not mount the sd card to access on the computer. However, this is not the case. I always get a message"your sd card is busy" when I do that. Any ideas? I don't want my phone to die while I'm listening. Battery life seems to be a constant problem win this phone that would be very nice if I could charge it for use.

    Just put the phone in 'PC' for USB Mode, plug it into your computer and you should be able to load and play music on the phone or the phone with the PC is turned off.    I throw my phone all the time that when I am traveling with Windows 7 on my laptop or Vista on my desktop when you work at home.   PC Mode is a shared reading where SD card is accessible by the PC and the phone and at the same time while allowing phone to load.

Maybe you are looking for