Sound play during keypress

Hi all,
I have a sound loaded that I would like to have smoothly play
while a key is held down.
So I have...
var eSound:EngineSound = new EngineSound();
...keypressed event, etc...
if (upArrowPressed)
if (eSoundPlaying == 0)
eSoundChannel = eSound.play();
eSoundChannel.addEventListener(Event.SOUND_COMPLETE,eSoundComplete);
This is part of a game loop, and I have tried a number of
things with the eSoundComplete function too (re-checking status of
the up arrow and re-launching the play() if it's still down, etc.).
The idea is that while the player holds down the up arrow,
the engine sound will play. The engine sound is only about .5
seconds long and is loopable.
Currently if the player holds down the arrow key the sound
will play, stop, play, stop, etc. So there is a little delay
between each...like it's making a skipping sound.
Does anyone know how I can have the sound play as a seemless
loop *only* while a key is held down?
Thanks!
-K

make sure you have the recording input set correctly in your settings (look under Device options)
however your tv tuner is connected to your soundcard (eg Line-IN) then this should be set accordingly

Similar Messages

  • Another question, docking charger make my ipad2 no sound playing during charging

    i got a docking charger, when i plug in my ipad2 on my docking and play any video or music, there is no sound playing out, however, when i plug directly with the cable, there is sound playing out during charging, both situations give charging and shows the dock is working,  why it is like this? This just happened today, but i have updated ios 5.0.1 yesterday and did not have this problem.
    How to solve it? Thx a lots

    PLEASE HELP!

  • How can I stop timeline sounds in external swf files from playing during loading?

    I am having a problem with timeline sounds in external swf files playing during loading in a main swf. Can anyone help me?
    Here is some of the code from the main swf. I hope I have included enough.
    Thanks.
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.ProgressEvent;
    import flash.events.Event;
    import flash.net.URLRequest;
    import fl.events.SliderEvent;
    import flash.media.SoundTransform;
    preloader_mc.fill_mc.scaleX = 0;
    var swfA:Array = ["part1.swf","part2.swf"];
    var frameA:Array = [];
    var currentLoader:Loader;
    var swfTotalFrames:int;
    var tl:MovieClip = this;
    var st:SoundTransform = new SoundTransform()
    var index:int = 0;
    loadNextF();
    play_slider.enabled = false;
    function loadNextF():void{
                    tl["loader_"+index] = new Loader();
                    tl["loader_"+index].name = index.toString();
                    tl["loader_"+index].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressF);
                    tl["loader_"+index].contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
                    tl["loader_"+index].load(new URLRequest(swfA[index]));
    function progressF(e:ProgressEvent):void{
                    var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);
                    preloader_mc.fill_mc.scaleX = fractionLoaded;
                    preloader_mc.tf.text = (100*fractionLoaded)+"% Loaded";
    function completeF(e:Event):void{
                    tl["loader_"+index].contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,progress F);
                    tl["loader_"+index].contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
                    SoundMixer.stopAll();
                    var mc:MovieClip = MovieClip(tl["loader_"+index].content);
                    mc.gotoAndStop(1);
                    frameA.push(mc.totalFrames);
                    index++;
                    if(index<swfA.length){
                                    loadNextF();
                    } else {
                                    // all loads complete.  start play.
                                    restart_mc.buttonMode = true;
                                    restart_mc.alpha = 1;
                                    tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
                                    tl.removeChild(preloader_mc);
                                    preloader_mc = null;
                                    play_slider.enabled = true;
                                    playpause_mc.alpha = 1;
                                    currentLoader = tl["loader_0"];
                                    tl.addChild(currentLoader);
                                    MovieClip(currentLoader.content).play();
                                    sliderParamsF();

    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.ProgressEvent;
    import flash.events.Event;
    import flash.net.URLRequest;
    import fl.events.SliderEvent;
    import flash.media.SoundTransform;
    preloader_mc.fill_mc.scaleX = 0;
    var swfA:Array = ["part1.swf","part2.swf"];
    var frameA:Array = [];
    var currentLoader:Loader;
    var swfTotalFrames:int;
    var tl:MovieClip = this;
    var st:SoundTransform = new SoundTransform()
    var index:int = 0;
    loadNextF();
    play_slider.enabled = false;
    function loadNextF():void{
        tl["loader_"+index] = new Loader();
        tl["loader_"+index].name = index.toString();
        tl["loader_"+index].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressF);
        tl["loader_"+index].contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
        tl["loader_"+index].load(new URLRequest(swfA[index]));
    function progressF(e:ProgressEvent):void{
        var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);
        preloader_mc.fill_mc.scaleX = fractionLoaded;
        preloader_mc.tf.text = (100*fractionLoaded)+"% Loaded";
    function completeF(e:Event):void{
        tl["loader_"+index].contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,progress F);
        tl["loader_"+index].contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
        SoundMixer.stopAll();
        var mc:MovieClip = MovieClip(tl["loader_"+index].content);
        mc.gotoAndStop(1);
        frameA.push(mc.totalFrames);
        index++;
        if(index<swfA.length){
            loadNextF();
        } else {
            // all loads complete.  start play.
            restart_mc.buttonMode = true;
            restart_mc.alpha = 1;
            tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
            tl.removeChild(preloader_mc);
            preloader_mc = null;
            play_slider.enabled = true;
            playpause_mc.alpha = 1;
            currentLoader = tl["loader_0"];
            tl.addChild(currentLoader);
            MovieClip(currentLoader.content).play();
            sliderParamsF();
    ///////////////// start sliders /////////////////////////////////
    sound_slider.addEventListener(SliderEvent.CHANGE,soundSliderF);
    function soundSliderF(e:SliderEvent):void{
        st.volume = e.value/100;
        tl.soundTransform = st;
    play_slider.addEventListener(SliderEvent.CHANGE,playSliderF);
    play_slider.addEventListener(MouseEvent.MOUSE_DOWN,playSliderDownF);
    //play_slider.addEventListener(MouseEvent.MOUSE_UP,playSliderUpF);
    function playSliderDownF(e:MouseEvent):void{
        tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
        stage.addEventListener(MouseEvent.MOUSE_UP,playSliderUpF);
    function playSliderUpF(e:MouseEvent):void{
        tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
    function playSliderF(e:SliderEvent):void{
        SoundMixer.stopAll();
        var frameNum:int = Math.ceil(swfTotalFrames*e.value/100);
        var partialTotalFrames:int = 0;
        for(var i:int=0;i<frameA.length;i++){
            partialTotalFrames += frameA[i];
            if(partialTotalFrames>=frameNum){
                break;
        partialTotalFrames -= frameA[i];
        //trace(i,frameNum,frameNum-partialTotalFrames);
        if(currentLoader!=tl["loader_"+(i)]){
            tl.removeChild(currentLoader);
            MovieClip(currentLoader.content).stop();
            currentLoader = tl["loader_"+(i)];
            tl.addChild(currentLoader);
        if(playpause_mc.currentFrame==1){
            MovieClip(currentLoader.content).gotoAndPlay(frameNum-partialTotalFrames);
        } else {
            MovieClip(currentLoader.content).gotoAndStop(frameNum-partialTotalFrames);
    function sliderUpdateF(e:Event):void{
        var playedFrames:int = 0;
        for(var i:int=0;i<Number(currentLoader.name);i++){
            playedFrames += frameA[i];
        playedFrames += MovieClip(currentLoader.content).currentFrame;
        play_slider.value = Math.round(100*playedFrames/swfTotalFrames);
    function sliderParamsF():void{
        swfTotalFrames = 0;
        for(var i:int=0;i<swfA.length;i++){
            swfTotalFrames += MovieClip(tl["loader_"+i].content).totalFrames;
    ///////////////// end  sliders //////////////////////////////////
    ///////////////// start playpause restart ///////////////////////
    playpause_mc.addEventListener(MouseEvent.CLICK,playpauseF);
    playpause_mc.alpha = .2;
    restart_mc.addEventListener(MouseEvent.CLICK,restartF);
    restart_mc.buttonMode = false;
    restart_mc.alpha = .2;
    function playpauseF(e:MouseEvent):void{
        if(!e.currentTarget.toggle){
            MovieClip(currentLoader.content).stop();
            tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
            e.currentTarget.gotoAndStop(2);
        } else {
            MovieClip(currentLoader.content).play();
            tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
            e.currentTarget.gotoAndStop(1);
        e.currentTarget.toggle = !e.currentTarget.toggle;
    ///////////////// end playpause //////////////////////////////
    function playUpdateF(e:Event):void{
        sliderUpdateF(e);
        var playingFrame:int = MovieClip(currentLoader.content).currentFrame;
        if(playingFrame==frameA[Number(currentLoader.name)]){
            // next loader
            MovieClip(currentLoader.content).stop();
            SoundMixer.stopAll();
            MovieClip(currentLoader.content).mute();
            var nextIndex:int = Number(currentLoader.name)+1;
            if(nextIndex<swfA.length){
                tl.removeChild(currentLoader);
                currentLoader = tl["loader_"+nextIndex];
                tl.addChild(currentLoader);
                MovieClip(currentLoader.content).gotoAndPlay(1);
            } else {
                tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
                playpause_mc.gotoAndStop(2);
                playpause_mc.toggle = !playpause_mc.toggle;
                //playpause_mc.alpha = .2;
                // all swfs have completed play
    function restartF(e:MouseEvent):void{
        MovieClip(currentLoader.content).stop();
        tl.removeChild(currentLoader);
        SoundMixer.stopAll();
        MovieClip(currentLoader.content).mute();
        currentLoader = tl["loader_"+0];
        tl.addChild(currentLoader);
        if(playpause_mc.currentFrame==1){
            MovieClip(currentLoader.content).gotoAndPlay(1);
        } else {
            MovieClip(currentLoader.content).gotoAndStop(1);

  • No sound captured during Capture Now

    First time in many moons using FCP. I'm capturing from a mini DV (Canon Eulura 70) using the Capture Now function. The problem is that it appears that no sound is being captured. I've read other posts about not hearing sound during capture... at the moment I'm using headphones connected to the camera and the sound is fine. I'd prefer to use the computer to monitor the sound but I cannot locate a checkbox anywhere to turn this feature on.
    When I drop the captured clips onto the canvas no corresponding audio file appears in the timeline, and no audio plays during playback. I've checked the clip setting in log/capture and it's set to capture both video and audio. I've checked System Settings, and under Scratch disks it's set to capture video and audio separately. Audio playback in FCP is set to built-in audio. Sound is working fine in all other applications.
    I've tried trashing the preference files but no effect. Also I tried to just capture audio, and as soon as I hit esc, FCP crashes... this is totally repeatable. I also noticed that on the clip setting tab there is a section with a bunch of sliders (7 in all)... don't know what they do, but they are all greyed out.
    Camera works fine in iMovie...
    Message was edited by: Ronald Dans1

    There are no check boxes on that tab, only a pull down list entitled "Capture". The choices are Video and Audio, Video only, Audio only. I have it set to Video and Audio. Perhaps there are checkboxes in another version?

  • Sound stops during games

    Randomly my sounds stops during most of my games.  Clash of clans my sound will fade in and out like its trying to work properly, but other apps are just muted completely.  If im listening to music while playing a game, it seems to happen more often.  ALL sound is stopped, i have to exit my app to turn the music back on.  This happened after i synced some music.  It was TERRIBLE, but i managed to sync it 3 or 4 more times to try and correct the problem, it helped but didnt fix it.  One day my sound wouldnt even adjust.  Something is seriously wrong with this OS.  This has been a problem since iOS7.  And i was syncing my wifes new Justin Timberlake, apparently the iPod hates him as much as i do.

    NoSound problem with headphones? With speaker?
    If only with headphones have you tried another pair of headphones?
    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.             
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar                                      

  • Sound Effects DURING Slide Transitions?

    Essentially, is there a way to add a sound clip to play between slides, during the transition?
    I'm creating a Keynote presentation that will be exported into Quicktime with hyperlink-activated transitions, and would like a specific sound to play during the 'Magic Move' transition. When the sound is imported into the first slide, once the transition begins, it fades out and stops. Yet if I drag and drop the sound file between the slides, it just creates a blank slide with the sound effect icon in the middle.
    Any ideas?

    Nope, unless you have a soundtrack on your show, there's no other way to have sound during a transition.

  • Sound stops during automation recording.

    Alright here's a video example of what I'm talking about.
    When I'm doing a "Touch" Automation on one midi track, while recording a touch track the midi sound stops as soon as I move the slider.
    The automation still records, it's just that the sound stops during automation.
    In the video notice that as soon as i move the Volume Automation slider the midi playing
    stops. Why? I need to be able to monitor this while I'm adjusting the automation.
    Appreciate anyone's suggestions.
    It's Logic Express 8.0.2 by the way.
    http://s177.photobucket.com/albums/w238/perrycomo/?action=view&current=Example1. mp4

    NoSound problem with headphones? With speaker?
    If only with headphones have you tried another pair of headphones?
    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.             
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar                                      

  • How can I fix no sound problem during calls since I have upgraded iphone 4 to ios 7?

    Hi friends
    Since I have upgraded my iphone 4 to ios 7, I am practicing too much problems regarding to sound:
    - playing music has no sound at the same time no sound in during phone calls unless I open the speaker.
    - sometimes sound in music and phone calls comes back for short period and then same problem occuring again.
    I think and I beleave it is software problem and I feel that ios 7 have killed my iphone.
    any one has any idea how to solve the problem or downgrading  back to ios6

    Try a reset: hold down the home button along with the power button until you see the Apple, then let go.

  • When i login to my account and it takes me to the desktop, the error sound plays, then the rainbow wheel appears, and finder immediately stops responding

    It started yesterday when i was listening to itunes when all of a sudden the music stopped playing and i had to hold down the power button to shut it down and reboot, and then, when i logged back in, the error sound played, and then finder opened up, but the window was grayed out like i had another app selected, bu i didn't, so i tried to open up itunes and the icon started bouncing and then it stopped midbounce and i had to reboot again because finder wasnt responding. now when i log in, the error sound plays, and finder immediately stops working and then i have to reboot again because i cant click anything and i cant properly relaunch finder. please help

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, or by a peripheral device. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including Wi-Fi on certain iMacs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • How can I control the music that plays during Apple TV photo slide shows?

    I don't want to make my parents listen to Breaking Benjamin music as they watch my photo slide shows on Apple TV. Need something more sedate. But if a B.B. song is in my iTunes music library, it is a candidate for random selection as background music for my slide shows. How do I control what music plays during Apple TV photo slide shows?

    What I find is really silly, is the fact the music video's are listed under that artists albums in the Music menu. And when you go into the video 'album' (called 'Unknown' unless you change it) there is an option to shuffle the tracks. Clicking this just results in an error message. So, they should either remove that option if it is a video album, or, better yet, GET IT TO WORK. So silly of them to omit this.
    I have submitted feedback.

  • Mail notification sound plays after I have read a new message

    When a new message comes in, the mail sound does not play right away. Often I will see the email and read it. Then, some time after I've finished and the screen is locked again, the sound plays.
    This problem occured with iOS 4 and still happens in iOS 5.

    Hi,
    I have had chats/conversations that have shown the blue "unread" indicator which goes if you reselect the chat but appears again when you select another Chat.
    I have also had the red Unread number indicator showing on the Dock icon badge as a separate issue.
    This second I have resolved in Force Quitting the DOCK in Activity Monitor ( I will use Terminal but prefer an User Interface option).
    The first I tend to solve by dismissing that particular Chat/Conversation.
    As you have tried the DOCK reset method by both the recommended methods of doing so I would try a PRAM/NVRAM reset.
    Restart the Mac holding down the CMD+ALT+P+R keys all at the same time until you have heard three Start up Bongs.
    You can then let the Start up Continue.
    8:58 pm      Friday; January 2, 2015
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • I placed my ipad on top of my CPU with a music playing,i heard a crack on the sound and when i checked it,i can no longer hear a sound playing on my ipad.i tried to check place a headphone its still playing a sound but when i pull it out,wont play at all.

    i placed my ipad on top of my CPU with a music playing,i heard a crack on the sound and when i checked it,i can no longer hear a sound playing on my ipad.i tried to check place a headphone its still playing a sound but when i pull it out,wont play at all.

    I don't know if this will work but it's worth a try. I wonder if somehow you ended up with a short inside of your iPad. Give the things below are trying to see if that helps. Good luck.
    Try a Restart. 
    Press and hold the Sleep/Wake button for a few seconds until the red "slide to power off" slider appears, and then slide the slider. Press and hold the Sleep/Wake button until the Apple logo appears.
     Resetting your settings
    You can also try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. You won't lose any data, but it takes time to enter all of the settings again.
    Resetting your device
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears. Apple recommends this only if you are unable to restart it.
    Or if this doesn't work and nobody else on the blog doesn't have a better idea you can contact Apple. 
    Here is a link to their contacts with most of the information below. 
    http://www.apple.com/contact/

  • I was listening to music on my ipod shuffle when it went off.It hasn't turned on since then.When i connect it to the computer,the connection and disconection sounds play continuously without the ipod showing.What could be wrong or how can i get it to work

    I was listening to music on my ipod shuffle when it went off.It hasn't turned on since then.When i connect it to the computer,the connection and disconection sounds play continuously without the ipod showing.What could be wrong or how can i get it to work?

    Hello,
    I am currently an owner of an Ipod Touch 4th generation. I see you are having problems with your Ipod Touch, so I will try to find a solution to your problem.
    Hold down the Sleep/Wake and Home buttons for at least 10sec. or until Apple logo appears (Nothing will be lost, this is just a "Hard Reset")
    Hope that helps!
    If none of the above solutions work, can you please respond back ASAP as I will try to find another solution to your problem (This might even help others with the same problem!)
    Cheers!
    Pizza98704

  • How to make sound play in loop

    Hi
    How can i make sound play in loop? Is there any property in class SoundChannel responsible for this or i have to write my own function?

    Using the sound Object there is a property you can pass in which asks for number of Loops
    Play(startPosition:Number,LOOPS:int,SoundTransform)
    or you can create your own method that listens to SoundComplete and then trigger play again.  which in my opinion is the best to do because when you play a sound with a loop, and choose to have is begin at a position other than 0  then the loop will play starting from where you set the position.

  • No embedded video (empty bar) in FF ver. 15 32bit. Sound plays. Flash ver. 11.4.402.265. No problems in IE. Windows 7 x64.

    Installed FF 15 (32 bit) on a fresh copy of Windows 7 Ultimate edition (x64).
    Everything works fine except the embedded video.
    The video clip thumbnail is shown, when clicking on the clip the sound plays and the right-mouse click shows flash player options, but no video is shown (empty bar).
    No problems on original YouTube or other flash video sites were detected.
    No crashes detected.
    Please, advise.

    1) Started the FF in Safe Mode.
    The embedded video works normally (!!!)
    2) Re-started the FF in normal mode - got the problem.
    3) Disabled ALL plugins and ALL add-ons (except the flash player) in Normal Mode - got the problem (once again, ALL plugins / add-ons were disabled).
    Safe Mode - everything works.
    Normal Mode - problem occurs (with no relation to disabling plugins / add-ons).
    Looks like there's something built-in FF which has the problem with showing embedded video normally in FF Normal Mode.

Maybe you are looking for

  • How can I use sysnonym to hide two different views?

    hi, My question is how can I use 2 different users to login and they point to different views. However, in the program level, the view name always stand for "Test_View". I try to meet the requirements and do the followings: Step 1: In user A account,

  • Can no longer see google standard image above search bar

    I no longer see the standard google image above the search bar (firefox 3.6.3) == This happened == Every time Firefox opened == At some stage of updating firefox

  • Stuck with a white screen

    Hi, I get the startup sound immediately followed by a white screen. 2011 Macbook Air latest OSX (I think) Tried holding option key - nothing option cmd P + R - nothing option cmd F + O nothing I'm not very techie at all! is there an easy fix? The las

  • Material Avaliability check in Prodcution Order

    Greetings,,,,,,,,,,,                           I have two productin order , one for finsih material and other for semi finish material. when i check materila availibilty of semifinsh prodcution order (co02), i m getting mising part overview and missi

  • Parallel Execution and Partitioning ?

    Hi, Can anybody explain me -- "How to implement Parallel execution and Partitioning in Data Warehouse?" on a single server. Any examples related to implement Parallel Execution helps me a lot. Thanks in Advance, -Vency