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!
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.
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.
I'm having some trouble getting the following code to work - trying to use the new Sound.extract() function to get two seconds of a Sound into a ByteArray, and then create a new bytearray with a WAV header, and then output the file. The resulting 'test.wav' file sounds very wrong although slightly recognisable? I think I may have some of the WAV header settings may be wrong but I'm not quite sure what's the matter and after a long time scratching
I have a long mp3 file hosted on a standard apache server (30 minutes long so far, but I would like it to work with longer sounds too).I'd like to start playback of this audio within at a specified point. When attempting to use Flash Actionscript 3, my basic tests show that ALL the audio from the start to the position I choose is buffered before playback (Sound.bytesLoaded was my friend here). If I start one second in, it takes about 3 seconds to start playback, 30 seconds in, takes about 25 secondsObviously with a really long mp3, like skipping playback to the middle of a 3-hour audiobook, this isn't going to be practical.Here's the ActionScript 3.0 code I'm using:
button.addEventListener(MouseEvent.MOUSE_DOWN, function():void { var s:Sound = new Sound(); var req:URLRequest = new URLRequest("http://example.com/audio.mp3");
I would like to attach a sound to a .fla file that starts to play when the file is opened. I have created a button and would like to be able to use this button for a visitor to the site to mute the sound. So, I'm trying to accomplish two things, first attach a .wav file, then get the mute button to work.
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)?
I have the loading audio file at frame one. However, I want to play the audio only at specific frame or frame label. How do I do that? Below are my codes:
Quote: //start of sound section is for sound var soundReq:URLRequest = new URLRequest("FlashFiles/audioFiles/mySoundmp3"); var sound:Sound = new Sound();
[Code]....
The above plays the sound as soon as the .swf file is loaded. But I want to play at certain point in time, say frame number or frame label. I want to be able to put all my action script on frame one (or one location) instead of all over the time line.
var myVar:String = LoaderInfo(this.root.loaderInfo).parameters.myVar; var snd:Sound = new Sound(new URLRequest(myVar)); var channel:SoundChannel = snd.play();
Most of my flash movies have been reasonable sizes, but the one I'm working on now is kind of a beast. It's up against the 16000 frame limit, so I'm looking into ways to chop it up. The problem is that I need a way to keep my background music playing across multiple scenes or movies. Is there a way to start a sound file in one movie, and have it continue when another scene is loaded or when a second movie file is loaded with ActionScript?
I am have written a flash "reader" which I use as an aid for language studies. Various narrations are loaded into a combobox via an XML file, and the user can play the selected narration in a "sentence mode", a "passage mode" (several sentences) or in "continuous mode". (I use Soundbooth to set navigation cue points at the beginning of each "sentence".)
I would like to add a "Phrase Mode" which would cause the player to play the sound file until it hits a pause / quiet spot. In other words, if the user selected "phrase mode", the player would play to the next spot where there is no voice for x period of time. He/she will then be able to select 'repeat' to replay the phrase or 'next' to play the next "phrase" - as with the other modes. I am using FLVPlayback to play the .flv files.
I have a flash file with about 20 different scenes in it. And in one of the scenes there is an audio file that is 15 seconds long. The sound is on a menu page so i only want it in that scene. But if you are on that page for less than 15 seconds and go to another page then it carries on the sound into the next scene and if you go to and from the menu page to another scenes in quick succession you get a build up of sound which is horrible.
I have a Flash CS4 project with sound that starts to play in the first scene, set to event/loop so that it plays all through the entire time.
But I have a piece of video with audio in another scene and I would like to have the sound file playing at a lower volume while the video is playing, then get it to return to normal volume when the video is over.
I have no actionscript at this point. Just timeline animations, etc.
What I have are several items on a stage and when they are clicked I want to capture their names so I can use it to play a sound file that relates with the object clicked. For example: say I have a square, rectangle, and a square on the stage and when the user clicks on "triangle" it would play the sound "triangle_snd". This is what I have so far and the error I am getting from it.[code]...
Pause and Resume external SWF sound filesI have this code that plays the sound through linkage. It reside in scene1.fla -> scene1.swf.
var mc:MovieClip = this.createEmptyMovieClip("mc",1);var myLoop:Sound = new Sound(mc);myLoop.attachSound("bg_sound");myLoopVolume=0;myLoop.setVolume(myLoopVolume); mc.onEnterFrame = function () { if (fadeIn01==1) {
I have a flash file with several frames. In each frame I need to play a sound file.I've added all the sounds to the library and done all the necessary steps to export for actionscript.Here's my code to play the sound in one frame.
var sound1:Sound = new Cal10101(); sound1.play();
This works great to play the sound. I am using buttons to move to the next frame. When I click the button to move to the next frame, I need the sound from frame 1 to stop and a new sound which would be Cal10102 to start playing.How do I stop the sound from frame 1 from playing when I go to the next frame?
I need to know how to load and play a sound from within a CLASS definition file. I know the normal way of doing this, but Flash MX rejects that syntax, so there must be some special way of using sounds in a class file.
I need to know how to code for "if the score increases by any value." So, if the score goes from 0 to 1, the sound plays ONCE. If it increases from 1 to 2, the sound plays ONCE again.
I am triggering short sounds dynamically from the library for a game (Specifically Air for Android). When the user clicks a button the sound can take up to 600ms to actually play. I have set it for any silence before the actual sound by calling the sound like so:
[Code]...
All return the same results. I know there are threads here that talk about this but none have offered a real solution that I can find. Is there no way to cache the sound or store it in a buffer?
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.
like row sound we put buffer, like thisbuffer = new SoundLoaderContext(65000);_loop_snd = new Sound(new URLRequest(_mp3), buffer); how can i put buffer in dynamic sound..as per your code where i can put buffer in below code..
_dynamicSound = new Sound(); _dynamicSound.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);
the dynamicSound genrated from the row sound, means i modify the row sound.
the method for stopping/playing sound in 2.0 don't work for 3.0. i can stop the sound by going to a different page/frame on the site.but i want the buttons.
I'm new to Actionscripting and I want to add a sound file to my project with controls to stop and play and a volume slider. I'm using this actionscript for the controls. It works but right now you need to click the play button for it to start. Is there a different way to write it so that the music starts playing when the scene starts, and then the user can stop or play it again and change the volume?[code]
Drag and drop game. I'd like the instance to tint red when rolled over after it's been successfully dropped. I'd also like to play a sound file when clicked after successful drop. Here's the code:
ActionScript Code: addEventListener("dropped", dropper); function dropper(e:Event):void {
I have created a SWF file that plays/stops sound. The SWF file works great when previewed in Flash CS4, but does not work when inserted in the HTML file.Here are the 2 files that are automatically generated when I INSERT>MEDIA>SWF in Dreamweaver CS4:
swfobject_modified.js expressInstall.swf Here is the ActionScript3 that I am using in the Flash file:
I have a flash header that was never completed because the guy I hired took people's money and ran. So now I even wonder if what he said could work with my flash header is true or not. But, usually there is always a way to make it work.
I have a flash header that does two important things: 1) Upon entering the site, it loads and plays an audio track 2) Makes an animal noise when you hover over each animal menu item. (not sure if I'm able to give a link to it or not on here. If I able to and someone would like to see it let me know)
I want to know if my flash header can support the following additional functionality/changes:
1) Currently, it loads everytime a page is selected. I only want it to load the one time of entering the site because the audio gets annoying. Set a cookie maybe?
2) But, I do not want to turn the audio off completely because I still want the hover over each menu item sound.
3) Have a link on it to allow them to select to turn on / off the sound completely. It currently has that, but only for the current page. Once you select another page, the audio is back to on.
4) Lastlly, is there a way for it to detect that someone doesn't support flash and to display an html version of it? And can flash create a html version from my fla file?
I don't know much about flash (but am learning) so I'm not sure if I'll be able to do this myself. However, I want to find out if my flash header will even work this way before I invest the time learning it just for these changes. I know it will be pretty deep with script code, but I'm hoping I could find base code already available for these features. Not sure I can afford help now because of being laid off and two different scammers taking advantage of me. So I'm going to try to do myself and see if there is any suggestions/support on here that can help. I have Flash CS4.
I have several buttons in a movie and I want to be able to rollover an individual button and play the sound for that button and when I rolloff I want the sound for that button to stop.