Button for audio

I'm using a tutorial from flashkit.com to make a simple
button for audio on/off. Here's is the tutorial
Step One:
Create two buttons in your graphics program, one for
switching the music off and one for switching the music on.
Step Two:
Put both buttons into one Movie Clip. Each button on a
seperate frame. So you will have a MC with the first frame with the
"MUSIC OFF" button and the 2nd frame of the MC will contain the
"MUSIC ON" button.
Step Three:
Open the actions for the first frame of the MC and put in
this code:
stop();
and for the other frame add (The frame with MUSIC ON):
stop();
stopAllSounds();
Step Four:
Go to the first frame and open the actions for the button
(MUSIC OFF button):
on (release) {
gotoAndPlay(2);
Then for the MUSIC ON button add the same code but replace
the 2 with a one.
Step Five:
Now import your music file into Flash (Go to FILE>>
IMPORT) then go to your first frame of the MC and add your sound
into it. Under LOOP NUMBER put a big number like 9999 so the music
will go on for a long time.
I made my "button" in photoshop, and import it into flash,
its showing as a bitmap (I've tried saving it as a jpg, gif, and
png) when I preview my button after importing the music and adding
the script to each layer it plays the music, but you cant click on
it to turn the music on/off. I get this Error in preview
**Error** Scene=Scene 1, layer=on, frame=1:Line 3: Mouse
events are permitted only for button instances
on (release) {
**Error** Scene=Scene 1, layer=off, frame=1:Line 2: Mouse
events are permitted only for button instances
on (release) {
Total ActionScript Errors: 2 Reported Errors: 2
**Error** Scene=Scene 1, layer=on, frame=1:Line 3: Mouse
events are permitted only for button instances
on (release) {
**Error** Scene=Scene 1, layer=off, frame=1:Line 2: Mouse
events are permitted only for button instances
on (release) {
Total ActionScript Errors: 2 Reported Errors: 2
What am I doing wrong? And how do I make my image into a
button? Thank for any help!

> Step Five:
> Now import your music file into Flash (Go to
FILE>> IMPORT) then go to your
> first frame of the MC and add your sound into it. Under
LOOP NUMBER put a big
> number like 9999 so the music will go on for a long
time.
>
> I made my "button" in photoshop, and import it into
flash, its showing as a
> bitmap (I've tried saving it as a jpg, gif, and png)
when I preview my button
> after importing the music and adding the script to each
layer it plays the
> music, but you cant click on it to turn the music
on/off. I get this Error in
> preview
the button has to be actual flash BUTTON instance not just
button image.
You need to convert each symbol into BUTTON.

Similar Messages

  • Since I've updated to iOS 6 I am unable to use the next/back buttons from Headphone for audio book chapters.

    Since I've updated from iOS 5 to iOS 6 I am unable to use the next/back buttons from Headphone for audio book chapters.
    This is working fine for albums but are broken for audio books.
    The back button refers always to the first chapter of the audio book (very annoying if you are in the middle of an audio book) and the nex button goes one level higher back to the selection of the audio book itself.
    In iOS 5.0 it was still possible to navigate throught the audio book chapters using these buttons.
    This still happens in iOS 6.1.
    Is this a known bug?
    Does any solution exist?
    Thx,
    Oliver

    To gdgmacguy your a f****** idiot for one I'm having the same problem as pennymar. And you tell me to quit whinning. You got more problems then the iOS 6 you did not answer my question nor the other 13 or whatever you replied to within a 30 min time frame. You must got nothing better to do then to harass people and to pretend you know something about apple products. Which you don't from what I've read the other advices you should have gave to other people. But you didn't you replied a question back to the people asking a question. So if your not gonna use these community forums the right way don't use them at all.

  • Master On/Off Audio Button for Multiple swfs

    I need to create a “master” On/Off Audio Button
    that will control audio for a series of swfs loaded into a
    “master” swf. Each loaded swf will have a Media Display
    or FLV Playback MP3 progressive audio file supplying audio with cue
    points for that imported swf.
    What ActionScript would work for a “master”
    On/Off Audio Button in the main swf that would control audio for
    all of the loaded swfs so a setting in the “master” swf
    would effect all loaded swfs without the user needing to reset the
    On/Off Audio Button for each swf?
    Thanks!

    Use an array to store the names for each of the sound/video
    objects and then cycle through them and shut each off.

  • Linking audio to an image or a button for fixed layout export

    I can't seem to correctly link an audio file either to a button (another image) or selecting a custom poster frame.  No matter what settings I select the output is always the same as shown below:
    The audio are the two grey boxes...

    If you place a movie ... what's under the "Watch" text above ... there's no need to place the audio file for it separately. You just place the movie. The ereader puts its own controls on top of the move to play or pause it.
    In addition, you can add a button that will play the movie. The user can tap the button. To do that, make or place the button artwork in your layout file, then convert it to a button in the Buttons  & Forms panel. Then with the button selected, add an Action to the button: choose Play Movie drop down list of actions, and choose the filename for the movie from the list in the same panel.
    All the same is true for Audio files.  Users can tap the audio file to play/pause it, using the ereader's built in controls for audio files, and you can also make a button to play the audio, same as described for video.
    A button can only play a movie or audio that's on the same spread as the button itself.
    Does any of this info help? Are you trying to do something different than what I described?
    AM

  • My iphone4 recently stopped working in my car and no longer asks for audio sources.  It is paired and turns off the radio when a call occurs but does not utilize the speakers or mic in the car.

    My iPhone recently stopped asking for audio source in car and no longer works through the speakers.  It pairs with the vehicles just fine, turns off music, but I must use the actual phone to communicate.  What happened?

    The same problem I have today afternoon.
    My car audio system is compatible with iPod USB connector and worked fine for also 6 months.
    When connecting my iPod nano 6rd gen via USB to car audio system, iPod displays on its screen a sucessfull connection, and music tracks is successfully displayed on the car audio system. But do not play. Switch forward or backward by playlist (by the buttons on the car audio system) works also, but still there is no start playback.
    I tried plugged my iPhone 5 via USB to car audio system - it's works fine.
    I plugged iPod to my mac computer - itunes says it's all Ok.
    I am confused and do not understand what is happening.
    May be restoring to default factory settings iPod....

  • HT201359 I purchased a audio book to listen to on my commute to work. It only works over wifi, that does me no good in the car and the book is hours long for audio. That will eat up my data. How can I get a refund?

    I purchased a audio book to listen to on my commute to work. It only works over wifi, that does me no good in the car and the book is hours long for audio. That will eat up my data. How can I get a refund?

    How are you trying to listen to it ? You shouldn't need to be online to listen to it, I don't for any of mine. If you've downloaded it directly on your iPad (or synced it from your computer) then it should be in the Music app (you will get an Audiobooks option under the More button in the Music app when you have audiobooks on it) - is that where you are trying to listen to it ?

  • How to disable the select options button, while audio is playing in the question template in captivate 8?

    How to disable the select options button, while audio is playing in the question template in captivate 8?

    Apologies for late reply.
    I mean "On Question screens audio keeps on playing even after we have selected an option or options depending on the question type and clicked Submit. How do we stop the audio on selecting an option?"

  • Where I can find bitrate info for audio file?

    I just upgrade to OS X 10.9.2 and I can't find bitrate informations for audio file in Finder's info window. Is there someone with the same problem?

    Here's an Automator Service that wil give you a pop-up:
    (Highlight the audio file, right click and select the service name)
    Open Automator, Select Service.
    The Service is:
    The Run Shell Script Action is:
    echo $(( $(mdls -raw -name kMDItemTotalBitRate "$1" ) /1000 ))  \(File: "${1##*/}"\)
    The AppleScript is:
    on run {input, parameters}
      display dialog "Total bit rate: " & input buttons {"OK"} default button 1
              return input
    end run

  • I installed an HP update for audio driver, now audio doesn't work,

    downloadde and installed an HP update for audio driver, don't think it installed successfully however now my audio doesn't work. is it possible to do a system restore on win 8.1?
    HP Pavilion 500-214
    This question was solved.
    View Solution.

    Actionhero, welcome to the forum.
    Yes, it is possible to do a System Restore.  Here is a guide that will help you with it.
    Please click the "Thumbs Up+ button" if I have helped you and click "Accept as Solution" if your problem is solved.
    Signature:
    HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
    HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
    HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
    HP Photosmart 7520 AIO
    ++++++++++++++++++
    **Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
    Intelligence is God given; Wisdom is the sum of our mistakes!
    I am not an HP employee.

  • Where is the "accept" button for iTunes Store Terms and Conditions on the iPad?

    Where is the "accept" button for iTunes Store Terms and Conditions?  Can't use iTunes on my iPad without accepting conditions.

    Which tab in the iTunes app are you in ? If you are in the Downloads tab then the Ts & Cs link shows if you don't have any outstanding downloads - your download and synced films and TV shows should be in the Videos app and your music, audiobooks and audio podcasts in the Music app

  • "An error occurred while updating the default player for audio file types"

    Getting ready for a deployment of version 9.2 of iTunes for 1400+ users.
    Getting this error when a 'normal' user goes into Edit/Preferences of iTunes and makes no changes.
    "An error occurred while updating the default player for audio file types. you do not have enough access privileges for this operation."
    I've elevated privileges of the C:\program files\itunes directory for this user to Full Control however problem remains.
    Tried to modify the folder to remove 'read-only', as found this suggestion on here, but read-only keeps applying itself.
    User has full rights to the location of the media as specified under Advanced Tab. If I tick 'Set as default media player' and remove tick and then click OK I do not get the error. From what I've read it's affected older versions of iTunes also.
    Doe anyone have any other suggestions?
    Thanks in advance.

    I had a similar issue. Turned out that - somehow - one of the directories or files in my iTunes music folder had gotten set to read only. Fixing it was easy.
    Go to Edit/Preferences.
    Choose the Advanced tab
    in the General subtab select the contents of the box labeled "iTunes Music folder location"
    Click Start, choose Run
    Paste the location
    Press the button to move up one level
    Right-click the music folder, choose Properties
    If this is your problem, the read-only box will be a solid color or checked. Set it to empty and choose the default "apply to folder and all subfolders and files." This will set everything in there readable, which after I did so I stopped getting the error.

  • How do I include an entire hour-long performance on a DVD and also have menu buttons for playing isolated sections of the performance?

    How do I include an entire hour-long performance on a DVD and also have menu buttons for playing isolated sections of the performance?
    So far, I've already done the individual menu buttons for sections of the performance. How do I set up some kind of "play" button that will play the video of the entire performance straight through? Will this be too much material for the DVD to hold? Does the program recognize and not replicate material to save space? If so, will it interfere with that if  I add edits to individual sections that will not be in the video of the entire performance?   

    Hi
    If You only need
    • Play movie in full
    • Start into the movie at specific places e.g. Chapters - then play to movie ends
    Then this is fairly simple - Just add Chapters in Your Video-editor (iMovie or FinalCut)
    (some quirks to keep in mind - No Chapter mark in any transition or within 2 sec from it - AND - only Lettera A to Z and 0 to 9 - no other letters/symbols at all)
    BUT
    If You want to
    • Play full movie (with or without Chapters)
    • Play an individual Chapter then return to Menu
    This function is not standard in iDVD - but has to be faked one way or another.
    Please read my notes on this and be aware of the 60 minutes / 12 minutes limit in iDVD (THIS is including the Menu and it can take 15 minutes or more from the movie time)
    Play all resp one chapter at a time
    Play All Button
    1. There are NO - Play All - button in any version of iDVD
    2. It can be faked in several ways
    • Easiest and most fault proof way is to make a doublet movie containing All and with
    Chapters set to match. It will take up x2 space but is easy to understand and produce.
    Cons: Tried this in iMovie’11 by Exporting out each part as a full Quality QT.mov then Importing back into new events and putting these into a new project (Play All project). Resulting DVD had Audio that was OK (as parts) - BUT the picture was very bad and standing photo were cut of in hight. So the Play All movie has to be created from same material and exactly in the same way as the individual parts + then Chapters has to be set to match.
    • It's said that one can put all movies into a Photo/SlideShow and this will also
    give the function of a Play All button - Tested - and ONE HAS TO un-cheque - Scale pictures to TV-Safe area else it will be a black frame all around and a small picture !
    Cons: BUT - When tested with music videos - the same video on main Menu played nicely with OK Audio. The Play All version in SlideShow had a signifcant Distortion - as on telephone or worse.
    Mike Evangelist1
    You might be able to get close to what you want by using a slideshow in iDVD. (It's not widely known, but you can put videos in a slideshow.) If you set the slide duration to manual, playback will pause after each movie/slide, and you can continue with the 'next' button.
    3. Using another program to do this e.g.. Roxio Toast™ where there is a Play All button option.
    Summary
    a. Making a Play All movie with same care as the individual Part movies - gives a very Good Result
    b. Using Roxio Toast™ - also an usable way to go
    Yours Bengt W

  • Traits for Audio elements?

    I am trying to create a very simple player example that responds to the type of media being loaded.
    I can get it to display a play button for video, and not display it for a JPG. However, I can't seem to get it to work for audio; none of the traits you'd expect are being detected on the element when I specify an MP3 file (e.g. play trait, audio trait, time trait).
    Below is my code for the player. I thought maybe the file wasn't loaded completely before I was trying to get its traits, so I tried an if statement -- but that's not the case for the other media types, and the if statement didn't seem to make a difference. Can you see a problem with my code below? Am I missing a step here?
    TIA,
    // Lisa
    package
        import flash.display.Sprite;
        import org.osmf.containers.MediaContainer;
        import org.osmf.media.DefaultMediaFactory;
        import org.osmf.media.MediaElement;
        import org.osmf.media.MediaPlayer;
        import org.osmf.media.URLResource;
       import org.osmf.utils.URL;
        import org.osmf.traits.*;
        import flash.display.Graphics;
       import flash.display.Sprite;
       import flash.events.MouseEvent;
       import org.osmf.events.PlayEvent;
       import org.osmf.layout.LayoutUtils;
         * The metadata sets the SWF size to match that of the video.
        [SWF(width="640", height="480")]
        public class HelloPlayButton extends Sprite
            public function HelloPlayButton()
                // Create the container class that displays the media.
                 var container:MediaContainer = new MediaContainer();
                addChild(container);
                // Create URL
                //var mediaURL:URL = new URL("../images/swing.jpg");
                var mediaURL:URL = new URL("../audio/train_1500.mp3");
                //var mediaURL:URL = new URL("../videos/S0004_VP6_1Mbps.flv");
                // Create the resource to play
                var resource:URLResource = new URLResource(mediaURL);
                // Create a mediafactory instance
                var mediaFactory:DefaultMediaFactory = new DefaultMediaFactory();
                // Create the MediaElement and add it to our container class.
                var myMediaElement:MediaElement =  mediaFactory.createMediaElement(resource);
                container.addMediaElement(myMediaElement);
                // Create a media player
                var mediaPlayer:MediaPlayer = new MediaPlayer();
                // Stop from autoplaying
                mediaPlayer.autoPlay = false;
                // Then assign the media
                mediaPlayer.media = myMediaElement;
                var playButton:Sprite = constructPlayButton();
                // Add event listeners
                playButton.addEventListener(MouseEvent.CLICK, function():void {
                                   mediaPlayer.play();
                mediaPlayer.addEventListener(PlayEvent.PLAY_STATE_CHANGE, function():void {
                   playButton.visible = !mediaPlayer.playing;
    //tried this...
                if (myMediaElement.hasTrait(MediaTraitType.AUDIO)) {
                        var audio:AudioTrait = myMediaElement.getTrait(MediaTraitType.AUDIO) as AudioTrait;
                        trace("has audio trait");
    // and also this...
                var loadable:LoadTrait = myMediaElement.getTrait(MediaTraitType.LOAD) as LoadTrait;
                var playable:PlayTrait = myMediaElement.getTrait(MediaTraitType.PLAY) as PlayTrait;
                if (loadable != null) {
                    trace("This mediaElement is loadable!");
                if (playable !=null) {
                    trace("This mediaElement is playable!");
                    addChild(playButton);
                if (audio !=null) {
                    trace("This mediaElement has an audio track!");
                    addChild(playButton);
                function constructPlayButton():Sprite {
                var size = 100;
                    var x = 330;
                    var y = 225;
                    var f = 1.2;
                    var result:Sprite = new Sprite();
                var buttonArt:Graphics = result.graphics;
                buttonArt.lineStyle(1, 0, 0.5);
                buttonArt.beginFill(0xA0A0A0, 0.5);
                buttonArt.moveTo(x - size / f, y - size);
                buttonArt.lineTo(x + size / f, y);
                buttonArt.lineTo(x - size / f, y + size);
                buttonArt.lineTo(x - size / f, y - size);
                buttonArt.endFill();
                return result;

    Current code, with comments...
    package
        import flash.display.Sprite;
        import org.osmf.containers.MediaContainer;
        import org.osmf.media.DefaultMediaFactory;
        import org.osmf.media.MediaElement;
        import org.osmf.media.MediaPlayer;
        import org.osmf.media.URLResource;
        import org.osmf.utils.URL;
        import org.osmf.traits.*;
        import flash.display.Graphics;
        import flash.display.Sprite;
        import flash.events.MouseEvent;
        import org.osmf.containers.*;
        import org.osmf.elements.*;
        import org.osmf.events.*;
        import org.osmf.layout.*;
        import org.osmf.media.*;
        import org.osmf.metadata.*;
        import org.osmf.net.*;
        import org.osmf.net.dvr.*;
        import org.osmf.net.httpstreaming.*;
        import org.osmf.net.rtmpstreaming.*;
        import org.osmf.traits.*;
        import org.osmf.utils.*;
         * The metadata sets the SWF size to match that of the video.
        [SWF(width="640", height="480")]
        public class HelloPlayButton extends Sprite {
            public function HelloPlayButton() {
                // Create the container class that displays the media.
                var container:MediaContainer = new MediaContainer();
                addChild(container);
                // Create URL
                //var mediaURL:URL = new URL("../videos/S0004_VP6_1Mbps.flv");
                var mediaURL:URL = new URL("../images/swing.jpg");
                //var mediaURL:URL = new URL("../audio/train_1500.mp3");
    //**THIS THROWS AN ERROR
                //var mediaURL:String = "../videos/S0004_VP6_1Mbps.flv";
                // Create the resource to play
                var resource:URLResource = new URLResource(mediaURL);
                // Create a mediafactory instance
                var mediaFactory:DefaultMediaFactory = new DefaultMediaFactory();
                // Create the MediaElement and add it to our container class.
                var myMediaElement:MediaElement =  mediaFactory.createMediaElement(resource);
                container.addMediaElement(myMediaElement);
                // Create a media player
                var mediaPlayer:MediaPlayer = new MediaPlayer();
                // Stop from autoplaying
                mediaPlayer.autoPlay = false;
                // Then assign the media
                mediaPlayer.media = myMediaElement;
                var playButton:Sprite = constructPlayButton();
                addChild(playButton);
                playButton.visible = false;
                // Add event listeners
             playButton.addEventListener(MouseEvent.CLICK, function():void {mediaPlayer.play();});
                mediaPlayer.addEventListener(PlayEvent.PLAY_STATE_CHANGE, function():void {playButton.visible = !mediaPlayer.playing; });
                mediaPlayer.addEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE, mediaPlayerStateChanged);
                function mediaPlayerStateChanged(evt:MediaPlayerStateChangeEvent):void {
    //***THIS DOESN'T FIRE FOR FLV, ONLY MP3 AND JPG
                        if (evt.state==MediaPlayerState.READY) {
                            trace("MediaPlayerState -- READY!");
                            registerTraits();
                function registerTraits() {
                    trace("register traits");
                    if (myMediaElement.hasTrait(MediaTraitType.LOAD)) {
                        var loadable:LoadTrait = myMediaElement.getTrait(MediaTraitType.LOAD) as LoadTrait;
                        trace("This mediaElement is loadable!");
                    if (myMediaElement.hasTrait(MediaTraitType.PLAY)) {
                        var playable:PlayTrait = myMediaElement.getTrait(MediaTraitType.PLAY) as PlayTrait;
                        trace("This mediaElement is playable!");
                        addChild(playButton);
                        playButton.visible=true;
                    if (myMediaElement.hasTrait(MediaTraitType.AUDIO)) {
                        var audio:AudioTrait = myMediaElement.getTrait(MediaTraitType.AUDIO) as AudioTrait;
                        trace("This mediaElement has an audio track!");
                        addChild(playButton);
                        playButton.visible=true;
    //**IF I USE THIS SWITCH STATEMENT INSTEAD OF BASING ON TRAITS (ABOVE)
    //**I GET A COMPILER ERROR
    //**Error #1065: Variable org.osmf.elements::VideoElement is not defined.
                        /*switch (true) {
                            case myMediaElement is VideoElement :
                            trace("This is a VideoElement");
                            playButton.visible=true;
                        break;
                            case mediaPlayer.media is ImageElement :
                        break;
                            case mediaPlayer.media is AudioElement :
                            playButton.visible=true;
                        break;
                            case mediaPlayer.media is SWFElement :
                            playButton.visible=true;
                        break;
                 function constructPlayButton():Sprite {
                var size = 100;
                    var x = 330;
                    var y = 225;
                    var f = 1.2;
                    var result:Sprite = new Sprite();
                var buttonArt:Graphics = result.graphics;
                buttonArt.lineStyle(1, 0, 0.5);
                buttonArt.beginFill(0xA0A0A0, 0.5);
                buttonArt.moveTo(x - size / f, y - size);
                buttonArt.lineTo(x + size / f, y);
                buttonArt.lineTo(x - size / f, y + size);
                buttonArt.lineTo(x - size / f, y - size);
                buttonArt.endFill();
                return result;

  • I have five buttons with audio attached to each button. When I publish in html5 and test the buttons the audio cuts out at random times. Any suggestions. I have the latest version of Adobe Captivate 7

    Can someone please help me with this problem I cannot see how simply attaching audio to a button can be so problematic. I have no idea how to fix this.

    I am using CP8 and have found similar issues. When using the responsive project, my slides with multiple buttons have audio attached via advanced actions that will cut out if a user attempts to click another button before the first has finished playing. When the user listens to the entire audio file attached to the button, there are no issues with audio btw. I have tried attaching it to the button, but it plays when the button appears rather than on success. Furthermore, setting it to play audio on success is a problem because there are multiple actions that must be completed for each button. I have also found that setting audio any other way besides through advanced actions can create an audio overlap of more than one audio file. I haven't been able to find a way to time the advanced action or slide so that the user cannot click through the buttons without hearing all of the audio first.
    Any ideas on how to get around this problem would be fantastic if it doesn't require an entire rewrite. If I wasn't already 86% through the course development, I would use buttons to initiate branching scenarios which would fix a lot of my issues, but don't want to start over at this point.

  • The buttons for the audiofiles are big. Can I make them smaller?

    The buttons for the audiofiles are big. Can I make them smaller?
    Is it possible to scrawl, while an audio file is playing on another page?
    Thank you for your answers.

    I'm afraid the audio is an 'on page' function and will cease playing if you change pages. As to the size of the audio buttons, it is possible to make an image up to replace the standard audio button, but be advised that this just starts the audio, it cannot be used to pause it like the standard button can.
    The standard button is sized so that it is easy to hit with a finger - if you make it too small triggering the audio will become problematic.

Maybe you are looking for