How to code a button to play and pause sound using its loading?

How to code a button to play and pause sound using its loading? I used the sound load methos to fix the sound. Can someone help me?

Advertisement

I can't determine where the sound is defined and where you try to control it.  This will work but is sloppy coding:

Stop();

adaDrut1.onRelease = function () {}

_root.mySoundC = new Sound (this);

_root.mySoundC.loadSound ("F #/ Bhajni1.ark", true);

_root.mySoundC.onSoundComplete = function() {}

This.Start (); }

gotoAndPlay ("play2");

_Global.myTaalLaya = 'entries Low1. "

}

{play_btn.onRelease = Function ()}

_root.mySoundC.start ();

}

{pause_btn.onRelease = Function ()}

_root.mySoundC.stop ();

}

Tags: Adobe Animate

Similar Questions

  • Play an MP3 sound using its ByteArray

    With AS3 we can do to load an MP3 file and play:

    var sound: Sound = new Sound (new URLRequest ("sound.mp3"));

    Sound.play();

    It is very easy, but what happens if I already have all the ByteArray of this loaded MP3 and I just want to play?

    Why cant AS3 have a simple method to simply pass the ByteArray works exactly as it works now passing a URLRequest?

    In my case, I need it because I'm loading a ZIP file containing a bunch of MP3s and when decompressing them I can read the bytearray of each MP3 but I can't play them.

    Have you tried loadCompressedDataFromByteArray in the Sound class?

    Assuming you have the ByteArray already instantiated, try:

    var sound: Sound = new Sound();

    sound.loadCompressedDataFromByteArray (mp3Bytes, mp3Bytes.length);

    Sound.play();

  • How to reset many Solitaire games played and won Matches of the counters?

    How to reset many Solitaire games played and won Matches of the counters?

    Hi Keith,

    Found an answer for Vista, that should work for you in Windows 7.

    To reset the game statistics, you must delete some files. These files will be re-created automatically the next time you play the game. The files are located in the following location: 'C:\Users\[UserName]\AppData\Local\Microsoft Games\ [game]", where [username] is the name of your account and [game] is the name of the game (in your case, Solitaire). Just delete the contents of the folder, but DO NOT delete the folder itself.

    http://www.Vistax64.com/gaming/139902-Solitaire-statistics-reset.html

  • How can I configure firefox to play a beep sound when my yahoo or gmail mails to the?

    How can I configure firefox to play a beep sound when my yahoo or gmail mails to the?

    Hi, you could try the add-on x - notify .

    If your question is resolved by this or another answer, please take a minute to let us know. Thank you.

  • Y at - it an easy way to have a version number that the code VI has access to, and which is used as the version number for the executable file and the installer builds?

    Y at - it an easy way to have a version number that the code VI has access to, and which is used as the version number for the executable file and the installer builds? Now whenever I update my software I need to change the global variable where I store the version number, and then when I build I have in hand, open the properties and change the version number for the executable file and the installer. Is there an easy way to make these as all corresponding automatically?

    Have you tried a search? This question comes up a LOT. Here are the results of a search: http://forums.ni.com/t5/forums/searchpage/tab/message?location=Node%3A170&q=application+version#mess...

  • How to finalize a disc (CD - R and DVD +/-R) using Windows?

    Hello:

    How to "finalize" a disc (CD - R and DVD +/-R) using Windows?

    I want to finalize the disc... not simply close the session/disc.

    What I read in the help Windows, "closing" allows me to write on the disc later.

    Is this true, if the disc is just R, RW not?

    I burned the JPEG images (.jpg files) on CD - R and DVD + R discs.

    When I try to read them in my Sony CD/DVD player, it does not recognize the discs.

    The Sony user manual said that records must be "finalized", not just "closed".

    What do you mean with Windows?

    I have treid finalize these discs with Roxio Creator Basic, but it does nothing, except eject discs.

    Windows has always said that disks have free space, and the DVD player is unable to recognize them.

    As I understand it, if the disc is finalized, will show him no available free space.  Is this correct?

    Note: The discs work fine on my HP laptop which uses Vista 32 bit Home Premium.  I can see JPEG images.

    Thank you...

    DaleB

    Hello

    See the link in BOLD below:

    Burning a CD
    http://Windows.Microsoft.com/en-us/Windows7/help/videos/burn-a-CD

    Disc burning: frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows7/disc-burning-frequently-asked-questions

    Should which CD or DVD format I use?
    http://Windows.Microsoft.com/en-us/Windows7/which-CD-or-DVD-format-should-I-use

    Format a CD or DVD
    http://Windows.Microsoft.com/en-us/Windows7/format-a-CD-or-DVD

    Burn a CD or DVD in Windows Explorer
    http://Windows.Microsoft.com/en-us/Windows7/burn-a-CD-or-DVD-in-Windows-Explorer

    Burn a CD or DVD in Windows Media Player
    http://Windows.Microsoft.com/en-us/Windows7/burn-a-CD-or-DVD-in-Windows-Media-Player

    Burn a CD or DVD in Windows Media Player: frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows7/burn-a-CD-or-DVD-in-Windows-Media-Player-frequently-asked-questions

    Change settings for burning a CD or DVD in Windows Media Player
    http://Windows.Microsoft.com/en-us/Windows-Vista/change-settings-for-burning-a-CD-or-DVD-in-Windows-Media-Player

    Burn a CD or DVD in Windows Media Center
    http://Windows.Microsoft.com/en-us/Windows7/burn-a-CD-or-DVD-in-Windows-Media-Center

    Burn a DVD-video using Windows DVD Maker disc
    http://Windows.Microsoft.com/en-us/Windows7/burn-a-DVD-video-disc-with-Windows-DVD-Maker

    How to burn DVDs with Windows DVD Maker
    http://www.7tutorials.com/how-burn-DVDs-Windows-DVD-Maker

    Close or finalize a CD or DVD
    http://Windows.Microsoft.com/en-us/Windows7/close-or-finalize-a-CD-or-DVD

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

    Excellent Forum for help with programs and CD/DVD problems
    http://Club.myce.com/

    I hope this helps.

  • Audio jack play and pause/stop when you press the various buttons

    Hi all

    I do a simple radio interface and I have 6 buttons which I want to have that specific preset song playing of the button located in the library screening and stop/pause the current song when you press any preset button.

    I tried to use the attachSound, with associated identifiers but don't know if it's the right way to go. He plays songs, but does not stop their...

    {mc_FM1preset1.onRelease = Function ()}
    {if(!this.) Toggle)}
    this.gotoAndStop ("release");
    radio_FM1. Text = FM1preset1
    FM1value = 1

    PlayFM1_1 = new Sound (this);
    PlayFM1_1.attachSound (FM1preset1_song);
    PlayFM1_1.start (0, 1);

    PlayFM1_6.pause;
    PlayFM1_5.pause;
    PlayFM1_4.pause;
    PlayFM1_3.pause;
    PlayFM1_2.pause;

    }
    }


    }
    {mc_FM1preset2.onRelease = Function ()}
    {if(!this.) Toggle)}
    this.gotoAndStop ("release");
    radio_FM1. Text = FM1preset2
    FM1value = 2

    PlayFM1_2 = new Sound (this);
    PlayFM1_2.attachSound (FM1preset2_song);
    PlayFM1_2.start (0, 1);

    PlayFM1_6.pause;
    PlayFM1_5.pause;
    PlayFM1_4.pause;
    PlayFM1_3.pause;
    PlayFM1_1.unload;

    }
    }

    then I tried just to put each piece in its own clip and using this code, but it still doesn't stop/pause the song.

    Stop();

    {mc_preset1.onRelease = Function ()}
    mc_song1. Play();
    mc_song2. Stop();
    }


    {mc_preset2.onRelease = Function ()}
    mc_song2. Play();
    mc_song1. Stop (1);
    }

    Does anyone have any suggestions? Any help would be great! Thank you!!!

    Basically, I just need to know how to do the supported mc or button to STOP / to PAUSE the song that plays

    Thank you!!!

    -PAt

    the sound class has no property of break.  It has a stop() method, you must use:

    {mc_FM1preset1.onRelease = Function ()}
    {if(!this.) Toggle)}
    this.gotoAndStop ("release");
    radio_FM1. Text = FM1preset1
    FM1value = 1
           
    PlayFM1_1 = new Sound (this);


    PlayFM1_1.attachSound (FM1preset1_song);
    PlayFM1_1.start (0, 1);
           
    PlayFM1_6.stop ();
    PlayFM1_5.stop ();  etc.
    PlayFM1_4.pause;
    PlayFM1_3.pause;
    PlayFM1_2.pause;
           
    }
    }

    }
    {mc_FM1preset2.onRelease = Function ()}
    {if(!this.) Toggle)}
    this.gotoAndStop ("release");
    radio_FM1. Text = FM1preset2
    FM1value = 2
           
    PlayFM1_2 = new Sound (this);
    PlayFM1_2.attachSound (FM1preset2_song);
    PlayFM1_2.start (0, 1);
           
    PlayFM1_6.pause;
    PlayFM1_5.pause;
    PlayFM1_4.pause;
    PlayFM1_3.pause;
    PlayFM1_1.unload;
           
    }
    }

  • Several video clips on stage and layers - play and pause all (via the buttons)

    I've been designing a Visual presentation in Flash CS5, there are a few video clips on the stage who are set to play a certain amount of time. The problem I have is that I'm not familiar with coding/actions. I want to have a play and a pause button to pause at any time (not a given) and speak with the public. Then, I want to be able to click on the play button to resume from there (wherever I stopped of). I hope get help and be able to learn from your responses. I don't know how clear my question is, but I can clarify if you need me for...

    Thank you very much!

    If you see no error message and everything works the way you want, you're good.

  • How to code a button full screen?

    I need to code a button full screen for a SWF file. I tried several ways, but I can't make it work.

    Here is my Script of Action:

    function goFullScreen (): void

    {

    If (stage.displayState is StageDisplayState.NORMAL)

    {

    stage.displayState = StageDisplayState.FULL_SCREEN;

    }

    on the other

    {

    stage.displayState = StageDisplayState.NORMAL;

    }

    }

    fsb.addEventListener (MouseEvent.CLICK, _handleClick)

    function _handleClick(event:MouseEvent):void

    {

    goFullScreen();

    }

    Here is my html code:

    < param name = "allowFullScreen" value = "true" >

    < param name = "allowFullScreenInteractive" value = "true" / >

    Any help with this would be greatly appreciated. I tried the online tutorials and code snippets, but none of them work. It's only a few lines of code, but I can't seem to get this feature runs.

    Thank you

    David

    the more I look at this code the most problems I see.  you have 3 tags object in this disorder.

    Just delete this file.

    Click file > publishing settings > html and to model , select flash - allow full screen.  Click file > publish.  test.

  • How the code 2 buttons with mouse events

    I'm trying to code two buttons, both with the mouse to the bottom of the events, but to perform different functions. When I coded the script, I got the following error message:

    1021: duplicate function definition.

    Use different function names.

  • How can I uninstall Microsoft Office Home and Student, so can re - load on another computer?

    I purchased Office Home & Student 2007 on 09/01/2009.  I installed it and everything was going well until my hard drive crashed. The person fixing my computer is advising me to abandon the computer because it's about 6 years and more.  The problem is, how do I uninstall/Ministry of the Interior so I can re - load on another computer.

    When I bought the software, it came not with a disc. I went to the microsoft website to get the downloaded software.

    AMG96,
    Thanks for visiting the site of the community responses to Microsoft Windows. The question you have posted is related to Office and would be better suited to the office community. Please visit the link below to find a community that will provide the support you want.  Community Office
    Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • When a subclass must have its own fields and when to use its super

    When a subclass must have its own fields and when to use fields of its superclass?


    Hi, thanks for reading this post!

    I would use a specific example to my question.

    public class BankAccount {
         private double accountBalance;
         
         public double getBalance() {
              return this.accountBalance;
         }
    }
    
    public class SavingsAccount extends BankAccount {
         private double accountBalance;
         
         public double getBalance() {
              return this.accountBalance;
         }
    }
    In the example of bank account, account Bank both SavingsAccount will have a getBalance() method. As a result, they
    both need an account balance field. My question is as getBalance() for both classes will occur exactly the same
    operation, when I should omit declaring the getBalance() method and the accountBalance in the subclass field, and
    When should I include them?

    My own thought is when we never instantiate a superclass object (for example, an abstract class), then we place
    common fields in the superclass abstract and subclasses have access to these areas via getter/Setter protected
    access the fields of the superclass. This is the principle of reuse.

    But if you do not need to instantiate a superclass and the superclass needs to maintain its own fields, then
    I would need to replicate the getBalance() accountBalance and field method in the subclass.

    Is my thinking correct or incorrect?

    Thank you in advance for your help!

    Eric

    Published by: er * August 22, 2011 20:19

    ER * wrote:
    If SavingsAccount inherits BankAccount.getBalance ()... getBalance () would return accountBalance bank account. This isn't the right result we want.

    In fact, I think that this is precisely what you want.

    We want getBalance() accountBalance bank account back when we use a BankAccount object and SavingsAccount accountBalance when we use a SavingsAccount object.

    I seriously doubt that. I think you are confused a bank account with a customer, who may have multiple accounts.

    In all the systems I've ever seen, a SavingsAccount IS - A BankAccount - that is to say, it is a subtype of real. Now, it can contain many other areas ('interest'?), that a normal account would not be 'balance' is not one of them.

    Winston

  • Click the button to play and click to reverse

    I have a test button, I'd like to have play a movie where a chart is growing. Once stopped, I would like to be able to click on the same button and have the graphic go backward. I'd rather have chronology reversed, rather than extend the chronology of the mc, because then I have to align the beginning and the end, and if we change, I have to remember to change the other.

    I have:

    btn_test.onRelease = function() {}
    If (_root.adinstance._currentframe! = 1) {}
    While (_root.adinstance._currentframe! = 1) {}
    _root.adinstance.prevFrame ();
    }
    }
    else {}
    _root.adinstance.play ();
    }
    }

    I get the expansion but when when it hits the while, it disappears the adinstance mc.

    Any ideas?

    You rarely want to use any kind of loop coded to animate something, especially a while loop (they can be particularly unpleasant).  Try something more in the sense of...

    btn_test.onRelease = function() {}
    If (_root.adinstance._currentframe! = 1) {}
    _root.adinstance.onEnterFrame = function() {}
    If (_root.adinstance._currentframe! = 1) {}
    _root.adinstance.prevFrame ();
    } else {}
    delete _root.adinstance.onEnterFrame;
    }
    }
    }
    else {}
    _root.adinstance.play ();
    }
    }

  • How to make the file initially muted and have playbar show its mute

    With Captivate 5.5 (newbie here), I use TTS to the narration of several slides. I want the narratiion be disabled by default and allow users to start. I think that the easiest way is to automatically cut the file and then users can activate the sound it if they want to hear the audio. I use the standard default playback bar skin.

    I found the system variable "cpCmndMute" for the break with the code and created a script that call on the first slide to assign a value of 1 to cut things "cpCmndMute". This certainly muted the audio, but I noticed that it has not affected the mute button in the playback bar, which I will not be changed. A user who would click on the mute button would actuall cut this file (which is already cut off) and you click a 2nd time to activate audio. How can I change the button in the PlayBar? Or better yet, what is a better strategy for this idea?

    Unfortunately the buttons are not tied to the code in a way that seems intuitive.  When you change the cpCmndMute it does not switch the button.  It seems that your options are limited.  I think that there are at least two viable options:

    (1) you could try to tickle the button with the code.  Mainly to find the function that is called by the button and then call the function, rather than change the code variable.  By calling the function of the button event handler, you assign I hope as the variable which is displayed/hidden in time.

    (2) you could create a widget bar reading (or have someone create one for you) and then initialize her with the button MUTE.

    Michael

    www.vtrainingroom.com

  • How can I find several duplicate files and remove the using Windows Explorer

    Somehow I see several duplicate on my computer files.  I can tell when they arrived as all the duplicate files ' _10-Mar-15_1. ' " However, I don't know how they arrived.  I think that Google Drive was the culprit, but I can't be sure.

    How we (me) use Windows Explorer to find all files with "_10-Mar-15_1." and delete them all?

    I am using Windows 7 64 bit

    Thank you!!!

    Windows Explorer can do no such thing. To remove recursively a certain file is easy - see below. To identify duplicates and remove some of them is much more difficult, because:

    • Are two files duplicates because
      -They have the same name?
      -They are the same size?
      -They have the same file date?
      -They have the same content?
      -Everything above?
    • When they are, which ones should be deleted?
      -The oldest?
      -The most recent?
      -The batch?

    Here's how to remove a certain file to recursively. Assume that they are in the folder "C:\Users\BHunter\Documents".

    1. Click the start planet.
    2. Type cmd. exe and press ENTER.
    3. Enter the following command and press ENTER:
      dir/s/b/p 'C:\Users\BHunter\Documents\_10-Mar-15_1 '.
      This will show you all the files whose name above.
    4. del /s /q "C:\Users\BHunter\Documents\_10-Mar-15_1."
      This will permanently delete all files with the name above. You cannot restore them.

Maybe you are looking for


HashFlare