Actionscript 3 :: Play Sound Without Delay?

Jun 16, 2011

I've got a couple of classes.

My document class (Main.as) instantiates the class player and Soundsloader.
In the player class when the player picks up an item in the game, i want to play a short sound. I do this with the following code: MovieClip(this.main_object.sound_loader).playPickUp();

In my document class i also instantiate the SoundsLoader which basically should load all the sounds. (just one in my sample code below)

package {
import flash.display.MovieClip;
public class SoundsLoader extends MovieClip{

[Code]...

However when i use the methods my swf file freezes for a moment, plays the sound and then continues. So what's the best way of doing this ? (i'm using a .wav sound)

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Making A Flash App - Sound Play Delay?

Apr 3, 2004

I am trying to develop my first flash app. The application emulates a "karaoke" service. It plays a background sound and at the same time records the sound coming from the mic. I use the "sound" class to play the sound (s.play() ) and the "netStream" class to record the mic sound (ns.publish("mysound", "record") ). In the same app, I then try to play these two sounds together. The problem is that I cannot synchronize them. My tests drove me to a conclusion which I am not certain for. The conclusion is that the method s.play() has a delay about 500ms until the sound starts playing. The result is that recording starts 500ms earlier than playback. When, then, I playback both of them the recording sound is 500ms after the backround sound. Is that delay for sure true?

View 12 Replies

ActionScript 2.0 :: Sound Then Go To URL After Delay

Aug 17, 2009

What I have is a landing page on my customers site, I want to hold it there until the user clicks a button in the flash file it then plays a short sound, 2 seconds and redirects the page. I have tried setinterval and cannot get it to work. What I have loads the flash file and after the set time plays the file then redirects, cutting off the sound.

On Frame1

Code:
var sndMusic = new Sound();
sndMusic.attachSound("mySound");
var duration:Number = 5000; // set the call delay

[Code].....

View 1 Replies

ActionScript 2.0 :: Dependant Sound Delay?

Apr 20, 2010

I've done the getting the time right bit and the ticking bit, but big problem arises with the background music. It's different every second, and what I want is that is it's launched at, say 19:00:00 the music will start at 00 seconds, if it's launched at 19:00:22 - at 22 seconds, at 19:00:45 - at 45 seconds etc. So far I have no idea how to do it, I am a total newbie in Flash..

View 3 Replies

ActionScript 3.0 :: 60 Millisecond Sound Delay?

Nov 8, 2010

The first time around, the sound play's exactly on time, After that it has about a 30-60 millisecond delay to re play it again. if i wait about 20 seconds it will be able to play exactly on time again...? Im new to the sound class, but i don't think i have done anything wrong...my sound is imported to the library, exported for actionscript,i have tried:

Code:
var myAudio:Sound= new myCustomSound();
myAudio.play(0,1);

[code]....

simply put the sound on the timeline of a movieClip its all the same, in the play() method, i have tried start time of 0 or 1 or not at all, same with # of loops. i have tried to re-create the sound object each time its called, or have other sounds in the background, or create longer sounds. ive used mp3s,wavs, the audio file has no silence at the beginning of it.

this happens in the flash ide, or the published swf or on my phone using air for android settings, problem is on the phone its a larger delay i would say 60 to 150 milliseconds, otherwise it probably wouldn't be a problem. on my phone, using mrDoobs stats class i can actually see the frame rate drop from 30 to 25 back to 30 once that estimated 20 seconds is up and its "ready" to play on time again. Something happens after that 20 seconds that it clears up and it will play on time again. I dont know what to think

I re-created it in a regular non air/android swf and its the same issue, i attached it if anyone want to take a look. so hard to see the delay on a regular cpu as the response is good, but its there. click to make a noise, do it again once on the balls on the platform and you will see that tiny audio delay as the ball jumps. however wait 20 sec and it will be exact again.

View 14 Replies

ActionScript 3.0 :: Sound Delay After Button Push?

Jan 2, 2009

I have made this little thing, its more or less just to try out some basic scripting, its a button that you would push and when you do so it would play a random sound out of six different sounds, and it does all that, but it delays the sound, so it has a short delay, does anyone know how to fix this? Here is a link to the page where the button is (test page).[URL]...

View 24 Replies

Professional :: Flash Sound Delay - No Synchronization

Jan 26, 2010

I've been suffering the fliction of making sounds playing synchronized in Flash, I load 4 mp3 files externally and once all of the 4 mp3 loaded completely, let them play, but they starts not at the same time, the files starts unsynchronized with a random manner, some times file a starts first, some times file c starts first, there are always files delay about 500ms, the wierd thing is, O only see it's running sync in one computer, in firefox browser, in IE not. Same problem like, we always experience the case that, when we click a music player button, the sound not starts immediately or click a stop button, the sound not end immediately.

View 2 Replies

ActionScript 3.0 :: Start Sound - Delay In Loaded MP3 Playing

Feb 2, 2009

I have recently updated to Flash CS4 and AS3 from Flash 8 - apart from one issue I have with the Sound Object. There seems to be a delay in the loaded MP3 playing when told to. This means that I am unable to add SFX to the game I am developing for a client, because the sound plays about 1-2 seconds after it is told to play. How to tee the Sound up, so that it plays immediately?

The process I am using is this:
Class defined to load all game assets defined in XML

All Sounds are loaded into their own Sound Object and a reference to each is held in an array and passed to the relevant Class (i.e. Player). The relevant Class tells the reference to the Sound to play - it plays, but 2 seconds after the collision detection Event has told the sound to play.

View 4 Replies

ActionScript 3.0 :: External Audio X Animation - Sound Delay

Feb 8, 2011

I have a few animations that run on different scenes each time a scene is loaded the external audio should start with it. Well here is the thing the animation always starts before my audio files and each scene gets bugged. I need to create an action that only allows my scene to start with the audio and also starts loading the next audio so it wont be dellayed.

On the first scene I have the following code:
scene 1 frame 1
var autoPlay:Boolean;
if(!autoPlay){
stop();}
scene 1 frame 2 animation starts and audio 1 loads
import flash.media.Sound;
[Code] .....

View 3 Replies

ActionScript 3.0 :: Slight Delay In Button Sounds During Sound Stream?

Jan 30, 2009

I have some sounds on buttons:

Code:
var mySound:Sound = new myLibrarySound();
myButton.addEventListener(MouseEvent.CLICK, playSound);
function playSound(e:Event):void

[code]....

... and that works fine. I then have some streaming music:

Code:
var myStream:Sound = new Sound();
myStream.load(new URLRequest("myPath.mp3"));
myStream.play(0);

... and that works fine too. Now, however, the initial button sounds have a slight delay -- I'd estimate about 150-250 ms. It's enough that rollover click noises happen about the time you click, and click noises happen about the time you release, etc. Now, here's the KICKER. It only happens in FIREFOX. CURSE FIREFOX. Seriously. I've been having so many Flash issues in FF3, it just drives me nuts. Firefox and wmode is a pain, Firefox and sound is a pain, Firefox has been crap for Flash development lately.

View 2 Replies

ActionScript 2.0 :: Delay Before The Frames Play Again?

Jan 23, 2010

This is what i want to do I have a pause button i want it when the picture clicks on the pause button once it stops the frames when they click on it again it starts the framrs again what code can i use to do this. I also have a back and forward button when that is clicked i want a delay set when they click on the back and forward button and release it I want a delay before the frames play again.

View 2 Replies

ActionScript 3.0 :: Create Dynamic Sound To Play Sound-file?

Oct 14, 2009

It's possible to play a sound file through AS, either by loading it from a folder or import it to flash. It's also possible to play a dynamic tone with flash.media.Sound + writeFloat.

But... is it possible to play a sound file with flash.media.Sound + writeFloat in some way? I want to play a sound file without having to deal with any files except the .swf!

View 9 Replies

Flash Movie Play - Processing A Delay

Feb 15, 2010

I'm working on a Flash intro for a site. After the Flash movie plays I want it to wait three seconds and then send them to the index page. Currently I'm using the action script:

[Code]....

I've got that keyed to the last frame. The issue is at the end of the Flash movie it displays the company logo image. Well with that script added to the last frame it just quickly blips up the logo then takes you to the main page so fast you don't even get to really see the logo. I want the viewer to have a couple seconds to take it in, but then move them along to the main site without them having to look for a button to press.

View 3 Replies

ActionScript 2.0 :: Play Sound/stop Sound Button?

Feb 13, 2007

i want to make a single button to play a sound, and if pressed again, stop the sound. and if pressed again, play the sound, and so on...
i know it has to be made with a boolean variable, true/false, but i just can't figure out how.

View 13 Replies

ActionScript 3.0 :: Delay Play Only Once - Code Executes Each Loop

May 5, 2010

I am new to flash. I can't seem to decifer the script examples in the help files. After a lot of trial and error the following codes works great. It delays playback on the video for the proper amount of time. The only problem is when the playback loops (like it should) the codes executes again. I only want to execute the code the first time thru.

[Code]...

View 6 Replies

Flex :: Play Multiple Sounds With A Custom Delay?

Dec 9, 2009

I need to realize a multiple-track player. The user can upload multiple tracks and mix (play them together). My problem is to allow the user to define an exact start position of each track to allow a synchronization between them, something like this:

Track 1: start at [x] sec.
Track 2: start at [y] sec.
play/stop

where the user can set the x and y. I've tried to realize it with AS2 (using netstream and setInterval) and AS3 (using netstream or sound and timer). Only if I set the same x and y both tracks are playing simultaneously.

View 1 Replies

IDE :: Add Sound - Sound To Play On The 'Over' State

Mar 6, 2009

I'm trying to add sound to some buttons. It's just a little metallic 'klink' sound that plays on rollover. I only want the sound to play on the 'Over' state. So I've set up a layer (just for sound) for the button and I add my sound in the 2nd frame (the Over state). Everything is cool. All is good. And the sound plays on rollover. But the sound also plays when I click the button (i.e. it also plays on the "Down" state). Why? The Down state keyframe is completely empty. What's going on here? I've only put the sound in the "Over" keyframe, why does it also play in the "Down" frame (or when I click)?

View 1 Replies

ActionScript 2.0 :: Play Sound Like "stop All Sound" Option In Flash?

May 17, 2003

I want to use a sound loop in my flash movie. The movie has many scenes. And the problem is that when I go to next scene or different scene I hear the sound repeating twice. I mean sound does not stop from first scene and begins from the different scenes.Is there any way to play sound like "stop all sound" option in Flash.

View 6 Replies

ActionScript 3.0 :: Play A Sound File And Show The Progress Of The Sound File Being Played

Mar 16, 2009

I have to play a sound file and show the progress of the sound file being played. I am using import flash.media.Sound; import flash.media.SoundChannel; But the PROGRESS event gives theprogress of loading of file. I want to know of much of the song has been played and how much more is left.

View 3 Replies

ActionScript 2.0 :: Swapping - Play The Client Side Mp3 First Then Only Play Server Side Sound Object Alternately

Aug 9, 2004

I am new to actionscript. I have created a script that will play server side sound object and client side mp3 files alternately. Now, I would like to play the client side mp3 first then only play server side sound object alternately. However, I have no idea how can I do so. The following is the code that need to be swapped:

[Code].....

View 2 Replies

ActionScript 2.0 :: Create A Delay Via SetTimer, SetInterval Or Delay?

Feb 23, 2009

I want to create a function based (not frame) delay of about 10 seconds to the function at the start of a flash movie, the code only needs to run once.I'm very new to actionscript and have been given links to SetInterval and SetTimer examples but they all seem to be very complex.The function is below. I believe it's possible to add the commandTimer(delay:Number, repeatCount:int = 0) how me to a simple example.

onClipEvent (enterFrame) {
framePos = int(_xmouse / 100 * _parent._totalframes);
if (framePos < 0) {

[code].......

View 4 Replies

CS3 Delay - Button To Play Frame 10 To 40 Then After Playing From Frame 10-40 The Movie Stops

Jul 3, 2010

how to code this on a button

onrelease
gotoandplay(10); // i need delay here before activating the next code below//
gotoandplay(80);

the trick is.. i want the button to play frame 10 to 40 then after playing from frame 10-40 the movie stops and then play frame 80 to 100

View 4 Replies

Delay (2 Seconds) A Video To Play In A Flash Video Player?

Jan 18, 2010

I was wondering how I can delay (2 seconds) a video to play in a Flash Video Player? I know one way is for me to add blank frames but I would like to know some other options.

View 2 Replies

ActionScript 3.0 :: Can't Get More Than One Sound To Play

Jan 25, 2011

I am trying to build a simple xml based mp3 player for a project. I have got as far as combo/list boxes populating.

The first time you click the a track to play it all is well.

However, when you click another track, the first stops, but then I get error message.[code]...

View 2 Replies

Flash5 Sound Does Not Play Just Once

May 14, 2011

I tried modifying the sound in Action Script but now I do not get any sound on the webpage, only hear the sound in preview on flash editor.It was looping sound on the web page and I did not want to have surfers having to hit the stop button. But I did want it to play just once.[code]

View 1 Replies

How To Add In OnRelease Play Sound

Feb 14, 2012

I have a "onRelease function"
CODE:
btn_4.onRelease = function () {
var yTween = new mx.transitions.Tween(slider, "_x", mx.transitions.easing.Strong.easeOut, slider._x, 695 , 0.600000, true);
}
This works good but I like to add in a "onRelease" play sound, too. How it have to look like and where do I have to place the sound? Because: When I add in a new function "onRelease" both block each other.

View 2 Replies

ActionScript 2.0 :: How To Play Sound

Dec 14, 2009

I have two files as: A.swf and B.swf.[code]While I am playing B.swf then music is plays perfectly. While I load it to in A.swf then music in not playing.I don't want to change anything in B.swf like new Sound(this). I want actionscript code only for A.swf.

View 5 Replies

ActionScript 2.0 :: Sound Does Not Play

Jan 21, 2010

I've got 3 swf files and they are all nested. Here's the structure: [code]The sound clip "m1p1" is loaded in the library of "cc_mod1_shell.swf".This setup works when I just test "cc_mod1_shell.swf". I can hear the sound clip. But, when I test the root level "cc_ shell. swf", the sound does not play. Can anyone tell me what I'm doing wrong? Why would this._ parent work when I'm just using the 2 files in question, and not when they are nested in another file?.

View 7 Replies

ActionScript 2.0 :: Get Sound To Play?

Mar 27, 2012

How do you get sound to play?

I am importing the sound and exporting in with an identifier "sjump".

I am trying to play the sound from a seperate .as file with the following code:

var sound_sjump:Sound = new Sound();sound_sjump.attachSound("sjump");sound_sju mp.start(1,0);

Why won't it play?!

Some of my sounds like if I attach "coin" instead of "sjump" work? Why is this?

View 3 Replies

ActionScript 2.0 :: Sound Can't Play

Sep 7, 2008

I have a Flash movie that uses the following code to load a Sound from the library[code]...

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved