Background music with control button

I have a presentation that introduces a substantive piece of music at the start like this:

_root. Music = New Sound();
_root. Music.attachSound ("intro_music");
_root. Music.Start (0,999);

(where intro_music is the identifier for the mp3 in the library. There is also an acting as an 'OFF' button / switch 'ON' and I want to use the following script to control the playback of the music that this button is activated by the end-user:

{We (Release)}
If {(_root.playing!=1)}
If (musicPosition == null) {}
musicPosition = 0;
}
_root. Music.Start(musicPosition,0);
_root. Playing = 1;
} else {}
If {(_root.playing == 1)
musicPosition=_root.music.position/1000;
_root. Music.Stop ();
_root. Playing = 0;
}}
}

When I use the button for the FIRST time (first press) script I really get the music begins to play again under the initial read. The second button silenced the two readings. Additional pressure restarts only one reading of music (controlled by the script button above). I am trying to establish what bit of the script button I need to delete or modify Flash to recognize that the video is already playing, but whenever I have to 'tweak' - I break! I am primarily a designer, not a programmer, so easy to follow suggestions on script changes would be great.

(PS the parameter number of loop in the script of punch (see above) - 999, does not have the loop attached at all - is this a bug?)

Sorry, missed that part. To do this, just initialize the variable game you have 1.

_root. Music = New Sound();
_root. Music.attachSound ("intro_music");
_root. Music.Start (0,0);
_root. Playing = 1; added this line
music.onSoundComplete = function() {}
_root. Music.Start (0,0);
};

Then when you click on the button, he'll know that music is already up and running as you would expect.

Tim

Tags: Adobe Animate

Similar Questions

  • Background music volume control

    I use Captivate 8.1 and I imported a background music to run through all the slides.  Can I create a button on the first slide that will allow the Viewer to increase/decrease the volume of the background music for all slides.

    No, the system volume control variable will affect all the audio, not only

    background.

  • AS3 code to support the player swf with control buttons

    I need code for flash player.the player includes play, pause, stop, next and previous with seek bar and time control.i have try my code that does not load my swf.. the code is...

    function swfLoadedHandler(e:Event):void {}

    trace ("loaded swf");

    currentSWF = MovieClip (swfLoader.content);

    playerSwf.btForward.addEventListener (MouseEvent.CL ICK, button_forward);

    playerSwf.btRewind.addEventListener (MouseEvent.CLI CK, button_rewind);

    playerSwf.btPause.addEventListener (MouseEvent.CLIC K, button_pause);

    playerSwf.btPlay.addEventListener (MouseEvent.CLICK, button_play);

    currentSWF.addEventListener (Event.ENTER_FRAME, checkLastFrame);

    }

    function checkLastFrame(e:Event):void {}

    If {(currentSWF.currentFrame is currentSWF.totalFrames)

    currentSWF.stop ();

    }

    playerSwf.sliderMc.width = (currentSWF.currentFrame/currentSWF.totalFrames) * 140;

    }

    function button_forward(e:Event):void {}

    currentSWF.nextFrame ();

    }

    function button_rewind(e:Event):void {}

    currentSWF.prevFrame ();

    }

    function button_pause(e:Event):void {}

    currentSWF.stop ();

    }

    function button_play(e:Event):void {}

    currentSWF.play ();

    }

    swfLoader.load (swfFile);

    playerSwf.container.addChild (swfLoader);

    function closePlayer(e:MouseEvent):void {}

    playerSwf.container.removeChild (swfLoader);

    removeChild (player);

    }

    }

    help me with another code to run my swf with player... and I had tied my swf and player pls help me pls refugees...

    Make your agreement code with the installation of your file.  If the file you provided for viewing is the file that the code does not work with, it's understandable, because the code does not reflect the items in this file.  Especially given that no such a code in this file, but also because if the code that you have demonstrated is in this file, it does not target properly objects... mainly because of the absence of an object named playerSwf that your code uses to target all objects through.

  • How can I control the volume of a voice in a video + background music

    I would like to control the volume of a person speaking in a video and the volume of the background music independently of each other with two volume bars. The problem seems to control the voice of the video.

    What I can do... but not really wanted to do:
    (1) control the volume on voice and music at the same time (but not independently)
    (2) control the music but no voice

    Here is the actionscript code that controls music. The ActionScript of voices is considered as being almost totally similar.

    I use Flash 8. (Any flv) video name is LD

    bgSound2 = new Sound (this);
    bgSound2.attachSound ("Guitar");
    bgSound2.start (0, 99);
    bgSound2.setVolume (0);
    playB.enabled = false;
    slider2.slideBar2._x = 20;
    slider2.slideBar2.onEnterFrame = function() {}
    bgSound2.setVolume (0-(this._x));
    };
    slider2.slideBar2.onPress = function() {}
    startDrag (this, false, 280, this ._y, 0, this ._y);
    };
    slider2.slideBar2.onRelease = slider2.slideBar2.onReleaseOutside = function () {}
    stopDrag();
    };
    stopB.onRelease = function() {}
    bgSound2.stop ();
    playB.enabled = true;
    stopB.enabled = false;
    gotoAndStop ("playB");
    };
    playB.onRelease = function() {}
    bgSound2.start (0, 99);
    playB.enabled = false;
    stopB.enabled = true;
    } ; stop();

    Thank you
    Jens

    Thanks A.Arun,

    Here's what I did
    My "quick" fix was to place the two sounds, actionscripts to _root, using the video voice for first script sound and music in the second. I deleted the break buttons (because you can still lower level 0) and for the first script, I used:
    bgSound1 = new Sound();

    Now, I can turn the volume on the two sounds independently to the bottom to the top.

    Sincerely
    Jens

  • the volume control on background music

    I finished my first iMovie composed of video clips.  I have two questions:

    How to lower the volume of the background music for a few seconds only

    How to disappear the music of a song before the end of the song.

    Thank you

    Hi, grosen25,

    There are two ways to adjust the volume in the latest version of iMovie (10.1.2).

    One way is to select the audio clip, and then click on the speaker icon in the toolbar at the top of your screen.   This will reveal a scroll bar

    allows you to adjust the volume from 0 to 400%.

    Another way is to first click on the settings button in the right middle of your screen and select 'Show waveforms' in the dialog box that results.  Then select the audio clip.  You will see a horizontal volume control line that runs through the clip.  Place your cursor on the line and move it up or down to increase or decrease the volume.

  • Satellite L350-10 b - can I use Toshiba with MediaMonkey control buttons

    Salvation is

    I can do the media on my Toshiba L350-10 b control buttons work with MediaMonkey?
    I don't use WMP... I found the application programmer Gennady Rakhvalov RemoteX, but the Mute button does not work here.

    So is it possible to use the buttons with MediaMonkey?

    Generally, the Toshiba control buttons are configured for Windows Media Player and you can't configure it with an another player software if these player software does not support the necessary options.

    I use WinAmp with my Toshiba control buttons, but this feature has been activated it WinAmp itself.

  • The existing video (with sound) creation in phase with a background music track

    You want to add a video with sound (movie maker) be in line with existing background music.  Someone singing a song in sync with an existing musical track

    Hi Michael,

    1. What is the operating system installed on your computer?

    2. using Windows Live Movie Maker?

    Please post with more information on this issue to get help.

  • can I burn a photo story with background music on a disc

    is it possible to burn a cd of photos with background music on a CD, I don't have a Movie Maker on my computer, can you suggest what I can do

    You might find that Movie Maker...

    Reach... Start / run... type or copy/paste...

    moviemk.exe

    Press on... Come in.

    If Movie Maker is on your system, it will launch.

  • No background music in Age of Empires II Collectors Edition.

    There is no background music in AoE II and AoE II Expansion.
    I tried just about anything and have scoured the internet for people with the same problem.
    Apparently, the problem is unusual for the collectors edition, as the background music for AoE II remains on the cd, after installation, to broadcast while playing the game.
    I tried different things, but none were successful.

    Yes, I turned up the volume on the computer and has nothing to do with a button "On / off music" non-existent.

    This may help for future reference. If DVD media does not contain files in a first time, you are out of luck. If so, it is probably compressed in a format to archive, similar to what Activision did with the development of their game. Different may be a compatibility issue with this game and CD/DVD drives. Originally, if I'm not wrong, an audio cable should be connected to the sound card of the user and the CD/DVD drive to transmit data to the audio chipset. New disks do not use technology.

    This could help:

    Click Start, click Control Panel, click performance and Maintenance and then click System.
    Click the Hardware tab, and then click Device Manager.
    Click on the + (plus sign) next to CD-ROM/DVD-ROM drives, click your CD-ROM drive, and then click Properties.
    Click to check the digital audio CD activate this CD-ROM devices checkbox and then click OK.
    On the file menu, click on exit to close the Device Manager window.

    ALSO! Take a look at this:
    http://sharkyforums.com/showthread.php?p=100456

    It would be strange if the collectors edition lacked the OST and then the original edition had.

    Thank you!

  • How to stop the background music?

    Installed firefox. During navigation it is background music nonstop. SOP how this music

    Try to delete the sessionstore.js file and files possible sessionstore-# .js with a number and sessionstore.bak in the Firefox profile folder.

    Delete sessionstore.js will cause App Tabs and groups of tabs open and closed tabs (back) to get lost and you will have to re-create them (take note or bookmarks if possible).

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/Firefox/tools > Modules > appearance).

    • Do NOT click on the reset button on the startup window Mode without failure.
  • Satellite A100-487: pointer speed & button control buttons have fallen alarmingly

    In the last two or three days keys cursor/pointer speed and control have dropped alarmingly.

    Also the icon in the system tray Tracker does not always record the touch pad is used, and what is normally when the speed drops.
    The pointer moves on the screen very well, but there is a significant delay to the derivative of the target or get any response to a click on the buttons when it is.

    I suspect a virus of some type, but after running Norton, Hitman Pro and Webroot Spyware I have found none. Can anyone suggest a possible cause/remedy please?

    Hello

    Have you noticed a full CPU usage while the cursor/pointer speed and control buttons have declined?
    Sometimes my answer mouse doesn t or moves slowly because the processor running at 100% and should run several background processes.
    Of course, a virus or malware could use rate increases the CPU at a higher level.

    I've noticed that Norton does not recognize some virus or some potentially dangerous files are not known to Norton Antivirus.
    For several months, I have been using the freeware AntiVirus program. It of fun and free!

    But maybe it's not a virus problem, but just something wrong with the system files and drivers of s.
    In this case, I would recommend reinstalled the common modules, touchpad driver/utility and Toshiba controls.

    In an enterprise value you need to reinstall the whole OS from the Toshiba Recovery CD!

    Check it out

  • Headphone control buttons does not work

    Hello

    I just used my V - Moda Crossfade LP to listen to the music and tried my control buttons. They do not work so I tried a few Ks AKG and buttons do not work also. Do I have to download an app or?

    A solution would be really nice!

    Hi Chris9292,

    As far as I know, these models are manufactured for Apple devices. There could be some compatibility issues at a Xperia device with buttons and the microphone. For example, if you click on the following link:
    http://v-Moda.com/crossfade-LP/

    They include the following: cable microphone 3 remote buttons control calls and music, as well as the volume on most smartphones and tablets, including the latest Apple devices, including the iPhone, iPad, iPod and Macbook (only compatible with Apple products volume)

    A third party may be accessory need more power than the phone can provide some. (If possible), I suggest that you connect Sony headphones to use this device to see if you encounter the same behavior.

  • How to make a background music place for some slides (without interruption)

    Version: Captivate 8

    Type: E Learning

    Slides: 40

    Question: Background music plays on all the slides instead of just the slides 10-35

    Things, I tried: Assignment of music to an unseen object (does not work because the music is cut when the blade stops for user input)

    Thank you all for your help in advance. For the problem, I created an interactive game in other slides module where the user has to make choices, these choices will have users to another branch of the slide according to this choice. This section of the lesson is all grouped. It would be so easy to add background music using the native tools in captivate, but there is no way of knowing don't Captivate Slides for listening to music.

    The assignment of the music to an invisible object causes music to be cut when waiting for the user to input and will be choppy sound when users need forward and backward between the menus.

    Is it possible to do this? I thought there might be a way to get a timestamp of the last slide and use it in a script to tell what part of the file music to start playing, but that seems to be more work than what is actually needed (and I'm not good with javascript)

    Is it somehow a way to tell Captivate all just when to start playback of a sound and when you stop, any slide is surfed to?

    If someone has understood this point, I'd greatly appreciate the help.

    Please let me know if additional information is necessary

    The only control that exists for the background music is to stop him on some slides. Maybe this will be the simplest workflow: Insert background music, set it to loop and mark all of the slides where he shouldn't play?

  • random animation + random sounds and background music

    Hi guys!

    I am new to AS3, but I have to do this project for the class, and I really don't understand how to do it.

    I searched the forums and the internet, but did not find a lot of information. I found most of this code on the Internet however, and while I understand very well, I master AS3 enough to program myself.
    Could you guys please help me a bit with this?

    That's what I'm trying to achieve:

    • Background music loop in the back, which begins with the opening of the swf file and never stops. I think I've realized that, with this piece of code:

    import flash.media.Sound;

    import flash.net.URLRequest;

    import flash.media.SoundChannel;

    BG music

    var music: Sound = new Sound (new URLRequest ("music1.mp3"));  same folder

    var sc:SoundChannel;

    SC = music.play ();

    One thing though: it would be cool to put in a loop, and I don't know how to do this.

    • I also need various small audio clips to play randomly above the aforementioned background music. I use this, which works a little, but I would like to have more control on the randomness. Ideally the clips should not play twice in a row. I don't know how to do this.

    import flash.media.Sound;

    import flash.net.URLRequest;

    import flash.media.SoundChannel;

    import flash.events.Event;

    songs of the var: Array = new Array ("sound1.mp3", "sound2.mp3");

    Sound: sound var;

    var soundChannel:SoundChannel;

    var randnum:uint;

    function playsong()

    {

    RandNum = Math.Floor (Math.Random () * Songs.Length);

    Sound = new Sound();

    Sound.load() (new URLRequest("sounds/"+songs[randnum]));

    soundChannel = sound.play();

    soundChannel.addEventListener (Event.SOUND_COMPLETE, playrandomsong);

    }

    function playrandomsong(e:Event)

    {

    playsong();

    }

    playsong();

    • Finally, I need to move from frame to frame at random to play different animations. For example:

    Project starts, background music starts playing, we hear random sounds played one after the other, while some animations are visible on the screen, playing in random order.
    I don't know how to do this.

    Thank you very much for your help! I'll try to find out on my own, but any help will be appreciated.

    use a Boolean value to prevent the execution of code:

    var alreadyExecuted:Boolean;

    {if(!alreadyExecuted)}

    alreadyExecuted = true;

    .

    . code you want to run only once, regardless of how many times this frame is entered

    .

    }

  • Sounds in my application do to stop the background music. iOS

    Hello

    I have an app for iPad. I use short sounds in it to the buttons in my user interface.

    Unfortunately when I start my application of background music in the music player stops immediately.

    Do you have any idea how to solve this problem? I don't want to stop the audio player of the user, but at the same time, I want my sounds.

    Thank you in advance.

    With AIR 2.7 on iOS, there is no way to stop the background music being silenced.

    However the sound stops only when you play in fact all of the music in the air and not at the time of launch application.

Maybe you are looking for